
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>flutter部分 · Aivin开发笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Aivin">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../native/ccpp.html" />
    
    
    <link rel="prev" href="../kotlin/kotlin部分.html" />
    

    
        <link rel="shortcut icon" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../assets/images/favicon.ico' type="image/x-icon">
    
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    首页
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../doc/常用网站.html">
            
                <a href="../doc/常用网站.html">
            
                    
                    常用网站
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../常用软件/常用软件和框架.html">
            
                <a href="../常用软件/常用软件和框架.html">
            
                    
                    常用软件和框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../doc/开发规范.html">
            
                <a href="../doc/开发规范.html">
            
                    
                    开发规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../doc/开源软件.html">
            
                <a href="../doc/开源软件.html">
            
                    
                    开源软件和框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../doc/Android常用代码.html">
            
                <a href="../doc/Android常用代码.html">
            
                    
                    Android常用代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../源码阅读/源码阅读配置.html">
            
                <a href="../源码阅读/源码阅读配置.html">
            
                    
                    源码阅读
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../源码阅读/其他框架源码.html">
            
                <a href="../源码阅读/其他框架源码.html">
            
                    
                    其他框架源码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../产品经理/产品经理.html">
            
                <a href="../产品经理/产品经理.html">
            
                    
                    产品经理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../设计模式/设计模式.html">
            
                <a href="../设计模式/设计模式.html">
            
                    
                    设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../设计模式/设计模式.html">
            
                <a href="../设计模式/设计模式.html">
            
                    
                    设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../设计模式/模式详解.html">
            
                <a href="../设计模式/模式详解.html">
            
                    
                    模式详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../设计模式/mvc等.html">
            
                <a href="../设计模式/mvc等.html">
            
                    
                    mvc等
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../数据结构/常用数据结构.html">
            
                <a href="../数据结构/常用数据结构.html">
            
                    
                    基本算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../数据结构/常用数据结构.html">
            
                <a href="../数据结构/常用数据结构.html">
            
                    
                    常用数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../常用算法/算法术语.html">
            
                <a href="../常用算法/算法术语.html">
            
                    
                    算法术语
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../常用算法/排序算法.html">
            
                <a href="../常用算法/排序算法.html">
            
                    
                    排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../常用算法/查找算法.html">
            
                <a href="../常用算法/查找算法.html">
            
                    
                    查找算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../常用算法/大数相加.html">
            
                <a href="../常用算法/大数相加.html">
            
                    
                    大数相加
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../常用算法/集合的所有子集.html">
            
                <a href="../常用算法/集合的所有子集.html">
            
                    
                    获得集合的所有子集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../常用算法/扫描线种子填充算法.html">
            
                <a href="../常用算法/扫描线种子填充算法.html">
            
                    
                    扫描线种子填充算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../常用算法/其他算法.html">
            
                <a href="../常用算法/其他算法.html">
            
                    
                    其他算法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../java基础/原码补码反码.html">
            
                <a href="../java基础/原码补码反码.html">
            
                    
                    Java部分
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../java基础/原码补码反码.html">
            
                <a href="../java基础/原码补码反码.html">
            
                    
                    原码补码反码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../java基础/java常用代码.html">
            
                <a href="../java基础/java常用代码.html">
            
                    
                    java常用代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../java基础/JVM详解.html">
            
                <a href="../java基础/JVM详解.html">
            
                    
                    JVM详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../java基础/类加载机制.html">
            
                <a href="../java基础/类加载机制.html">
            
                    
                    类加载机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../java基础/内存模型.html">
            
                <a href="../java基础/内存模型.html">
            
                    
                    内存模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.6" data-path="../java基础/GC机制.html">
            
                <a href="../java基础/GC机制.html">
            
                    
                    GC机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.7" data-path="../java基础/对象内存布局.html">
            
                <a href="../java基础/对象内存布局.html">
            
                    
                    对象内存布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.8" data-path="../java基础/继承多态.html">
            
                <a href="../java基础/继承多态.html">
            
                    
                    继承和多态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.9" data-path="../java基础/相等判断.html">
            
                <a href="../java基础/相等判断.html">
            
                    
                    相等判断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.10" data-path="../java基础/Java容器类.html">
            
                <a href="../java基础/Java容器类.html">
            
                    
                    Java容器类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.11" data-path="../java基础/Java枚举.html">
            
                <a href="../java基础/Java枚举.html">
            
                    
                    Java枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.12" data-path="../java基础/自定义异常.html">
            
                <a href="../java基础/自定义异常.html">
            
                    
                    自定义异常
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.13" data-path="../java基础/深度拷贝.html">
            
                <a href="../java基础/深度拷贝.html">
            
                    
                    深度拷贝
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.14" data-path="../java基础/泛型详解.html">
            
                <a href="../java基础/泛型详解.html">
            
                    
                    泛型详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.15" data-path="../java基础/线程详解.html">
            
                <a href="../java基础/线程详解.html">
            
                    
                    线程详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.16" data-path="../java基础/java注解.html">
            
                <a href="../java基础/java注解.html">
            
                    
                    注解详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.17" data-path="../java基础/数据解析.html">
            
                <a href="../java基础/数据解析.html">
            
                    
                    数据解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.18" data-path="../java基础/java8新特性.html">
            
                <a href="../java基础/java8新特性.html">
            
                    
                    Java8新特性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../android基础/android零散知识.html">
            
                <a href="../android基础/android零散知识.html">
            
                    
                    Android部分
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../android基础/基础控件使用.html">
            
                <a href="../android基础/基础控件使用.html">
            
                    
                    基础控件使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../android基础/android零散知识.html">
            
                <a href="../android基础/android零散知识.html">
            
                    
                    Android零散知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../android基础/android坐标体系.html">
            
                <a href="../android基础/android坐标体系.html">
            
                    
                    Android坐标体系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../android基础/APP的启动流程.html">
            
                <a href="../android基础/APP的启动流程.html">
            
                    
                    APP启动流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../android基础/View加载流程.html">
            
                <a href="../android基础/View加载流程.html">
            
                    
                    View加载流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../android基础/事件分发机制.html">
            
                <a href="../android基础/事件分发机制.html">
            
                    
                    事件分发机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="../android基础/控件绘制流程.html">
            
                <a href="../android基础/控件绘制流程.html">
            
                    
                    控件绘制流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.8" data-path="../android基础/常用shape.html">
            
                <a href="../android基础/常用shape.html">
            
                    
                    常用shape
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.9" data-path="../android基础/进程通信.html">
            
                <a href="../android基础/进程通信.html">
            
                    
                    进程通信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.10" data-path="../通信方式/通信方式详解.html">
            
                <a href="../通信方式/通信方式详解.html">
            
                    
                    通信方式详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.11" data-path="../android基础/Binder详解.html">
            
                <a href="../android基础/Binder详解.html">
            
                    
                    Binder详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.12" data-path="../android基础/Handler详解.html">
            
                <a href="../android基础/Handler详解.html">
            
                    
                    Handle详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.13" data-path="../android基础/Fragment详解.html">
            
                <a href="../android基础/Fragment详解.html">
            
                    
                    Fragment详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.14" data-path="../android基础/Activity详解.html">
            
                <a href="../android基础/Activity详解.html">
            
                    
                    Activity详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.15" data-path="../android基础/BroadcastReceiver.html">
            
                <a href="../android基础/BroadcastReceiver.html">
            
                    
                    BroadcastReceiver详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.16" data-path="../android基础/Service服务.html">
            
                <a href="../android基础/Service服务.html">
            
                    
                    Service详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.17" data-path="../android基础/动画详解.html">
            
                <a href="../android基础/动画详解.html">
            
                    
                    动画详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.18" data-path="../android基础/屏幕刷新机制.html">
            
                <a href="../android基础/屏幕刷新机制.html">
            
                    
                    屏幕刷新机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.19" data-path="../android基础/屏幕适配.html">
            
                <a href="../android基础/屏幕适配.html">
            
                    
                    屏幕适配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.20" data-path="../android基础/图片加载详解.html">
            
                <a href="../android基础/图片加载详解.html">
            
                    
                    图片加载详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.21" data-path="../android基础/WebView详解.html">
            
                <a href="../android基础/WebView详解.html">
            
                    
                    WebView详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.22" data-path="../android基础/沉浸式.html">
            
                <a href="../android基础/沉浸式.html">
            
                    
                    沉浸式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.23" data-path="../android基础/相机模块.html">
            
                <a href="../android基础/相机模块.html">
            
                    
                    相机模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.24" data-path="../android基础/地图模块.html">
            
                <a href="../android基础/地图模块.html">
            
                    
                    地图模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.25" data-path="../android基础/Androidstudio插件开发.html">
            
                <a href="../android基础/Androidstudio插件开发.html">
            
                    
                    Androidstudio插件开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.26" data-path="../android基础/Apk插件化开发.html">
            
                <a href="../android基础/Apk插件化开发.html">
            
                    
                    Apk插件化开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.27" data-path="../android基础/App组件化开发.html">
            
                <a href="../android基础/App组件化开发.html">
            
                    
                    App组件化开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.28" data-path="../android基础/sdk开发.html">
            
                <a href="../android基础/sdk开发.html">
            
                    
                    sdk开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.29" data-path="../android基础/APP优化.html">
            
                <a href="../android基础/APP优化.html">
            
                    
                    APP优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.30" data-path="../android基础/项目参数配置.html">
            
                <a href="../android基础/项目参数配置.html">
            
                    
                    项目参数配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.31" data-path="../android基础/App发布.html">
            
                <a href="../android基础/App发布.html">
            
                    
                    App发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.32" data-path="../android基础/Android外挂.html">
            
                <a href="../android基础/Android外挂.html">
            
                    
                    Android外挂
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.33" data-path="../android基础/Android字节码插桩.html">
            
                <a href="../android基础/Android字节码插桩.html">
            
                    
                    Android字节码插桩
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.34" data-path="../android基础/智能家居.html">
            
                <a href="../android基础/智能家居.html">
            
                    
                    智能家居
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../python/python基础.html">
            
                <a href="../python/python基础.html">
            
                    
                    python部分
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../python/python基础.html">
            
                <a href="../python/python基础.html">
            
                    
                    python基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../python/python爬虫.html">
            
                <a href="../python/python爬虫.html">
            
                    
                    python爬虫
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../gradle/Groovy.html">
            
                <a href="../gradle/Groovy.html">
            
                    
                    Groovy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../kotlin/kotlin部分.html">
            
                <a href="../kotlin/kotlin部分.html">
            
                    
                    kotlin部分
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.16" data-path="flutter部分.html">
            
                <a href="flutter部分.html">
            
                    
                    flutter部分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../native/ccpp.html">
            
                <a href="../native/ccpp.html">
            
                    
                    native部分
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../native/Linux.html">
            
                <a href="../native/Linux.html">
            
                    
                    Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../native/ccpp.html">
            
                <a href="../native/ccpp.html">
            
                    
                    cCpp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.3" data-path="../native/NDK.html">
            
                <a href="../native/NDK.html">
            
                    
                    NDK
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.4" data-path="../native/系统编译剪裁.html">
            
                <a href="../native/系统编译剪裁.html">
            
                    
                    系统编译剪裁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5" data-path="../native/音视频.html">
            
                <a href="../native/音视频.html">
            
                    
                    音视频
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.6" data-path="../native/音视频第三方库.html">
            
                <a href="../native/音视频第三方库.html">
            
                    
                    音视频第三方库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.7" data-path="../native/相关代码.html">
            
                <a href="../native/相关代码.html">
            
                    
                    相关代码
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../server/服务器部分.html">
            
                <a href="../server/服务器部分.html">
            
                    
                    服务器部分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../webDev/web部分.html">
            
                <a href="../webDev/web部分.html">
            
                    
                    web部分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="../人工智能/人工智能相关概念.html">
            
                <a href="../人工智能/人工智能相关概念.html">
            
                    
                    人工智能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="../面试真题/极飞.html">
            
                <a href="../面试真题/极飞.html">
            
                    
                    面试真题
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >flutter部分</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#flutter&#x90E8;&#x5206;"><b>1. </b>flutter&#x90E8;&#x5206;</a></li><ul><li><span class="title-icon "></span><a href="#flutter-&#x914D;&#x7F6E;"><b>1.1. </b>flutter &#x914D;&#x7F6E;</a></li><li><span class="title-icon "></span><a href="#your-flutter-application-is-created-using-an-older-version-of-the-android-embedding-its-being-deprecated-in-favor-of-android-embedding-v2"><b>1.2. </b>Your Flutter application is created using an older version of the Android embedding. It&apos;s being deprecated in favor of Android embedding v2</a></li><li><span class="title-icon "></span><a href="#&#x7B7E;&#x540D;&#x914D;&#x7F6E;-keystore"><b>1.3. </b>&#x7B7E;&#x540D;&#x914D;&#x7F6E; keystore</a></li><li><span class="title-icon "></span><a href="#app-&#x663E;&#x793A;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x754C;&#x9762;"><b>1.4. </b>app &#x663E;&#x793A;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x754C;&#x9762;</a></li><li><span class="title-icon "></span><a href="#flutter&#x5DE5;&#x7A0B;&#x4E2D;-android&#x90E8;&#x5206;&#x7206;&#x7EA2;"><b>1.5. </b>flutter&#x5DE5;&#x7A0B;&#x4E2D; Android&#x90E8;&#x5206;&#x7206;&#x7EA2;</a></li><li><span class="title-icon "></span><a href="#flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;-android&#x9879;&#x76EE;&#x90E8;&#x5206;&#x7206;&#x7EA2;"><b>1.6. </b>flutter &#x63D2;&#x4EF6;&#x5F00;&#x53D1; Android&#x9879;&#x76EE;&#x90E8;&#x5206;&#x7206;&#x7EA2;</a></li><li><span class="title-icon "></span><a href="#flutter-bloc-&#x6A21;&#x5F0F;"><b>1.7. </b>flutter BloC &#x6A21;&#x5F0F;</a></li><li><span class="title-icon "></span><a href="#&#x9879;&#x76EE;&#x7C7B;&#x578B;"><b>1.8. </b>&#x9879;&#x76EE;&#x7C7B;&#x578B;</a></li><ul><li><span class="title-icon "></span><a href="#flutter-application"><b>1.8.1. </b>Flutter Application</a></li><li><span class="title-icon "></span><a href="#flutter-plugin"><b>1.8.2. </b>Flutter Plugin</a></li><li><span class="title-icon "></span><a href="#flutter-package"><b>1.8.3. </b>Flutter Package</a></li><li><span class="title-icon "></span><a href="#flutter-module"><b>1.8.4. </b>Flutter Module</a></li></ul><li><span class="title-icon "></span><a href="#json"><b>1.9. </b>json</a></li><li><span class="title-icon "></span><a href="#&#x56FD;&#x9645;&#x5316;-&#x7FFB;&#x8BD1;&#x652F;&#x6301;"><b>1.10. </b>&#x56FD;&#x9645;&#x5316; &#x7FFB;&#x8BD1;&#x652F;&#x6301;</a></li><ul><li><span class="title-icon "></span><a href="#&#x7CFB;&#x7EDF;&#x81EA;&#x5E26;&#x7684;&#x63A7;&#x4EF6;-&#x56FD;&#x9645;&#x5316;"><b>1.10.1. </b>&#x7CFB;&#x7EDF;&#x81EA;&#x5E26;&#x7684;&#x63A7;&#x4EF6; &#x56FD;&#x9645;&#x5316;</a></li><li><span class="title-icon "></span><a href="#&#x81EA;&#x5B9A;&#x4E49;&#x63A7;&#x4EF6;&#x3001;&#x6587;&#x672C;&#x3001;&#x4FE1;&#x606F;&#x5C55;&#x793A;-&#x56FD;&#x9645;&#x5316;"><b>1.10.2. </b>&#x81EA;&#x5B9A;&#x4E49;&#x63A7;&#x4EF6;&#x3001;&#x6587;&#x672C;&#x3001;&#x4FE1;&#x606F;&#x5C55;&#x793A; &#x56FD;&#x9645;&#x5316;</a></li></ul><li><span class="title-icon "></span><a href="#&#x5C4F;&#x5E55;&#x9002;&#x914D;"><b>1.11. </b>&#x5C4F;&#x5E55;&#x9002;&#x914D;</a></li><li><span class="title-icon "></span><a href="#flutter-&#x8FD0;&#x884C;&#x6A21;&#x5F0F;"><b>1.12. </b>flutter &#x8FD0;&#x884C;&#x6A21;&#x5F0F;</a></li><li><span class="title-icon "></span><a href="#&#x72B6;&#x6001;&#x7BA1;&#x7406;"><b>1.13. </b>&#x72B6;&#x6001;&#x7BA1;&#x7406;</a></li><li><span class="title-icon "></span><a href="#&#x5F15;&#x5165;&#x672C;&#x5730;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;"><b>1.14. </b>&#x5F15;&#x5165;&#x672C;&#x5730;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;</a></li><li><span class="title-icon "></span><a href="#flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;"><b>1.15. </b>flutter &#x63D2;&#x4EF6;&#x5F00;&#x53D1;</a></li><li><span class="title-icon "></span><a href="#flutter-&#x4E0E;-android-&#x6570;&#x636E;-&#x4EA4;&#x4E92;"><b>1.16. </b>flutter &#x4E0E; Android &#x6570;&#x636E; &#x4EA4;&#x4E92;</a></li><li><span class="title-icon "></span><a href="#flutter-&#x8C03;&#x7528;android&#x63A7;&#x4EF6;"><b>1.17. </b>flutter &#x8C03;&#x7528;Android&#x63A7;&#x4EF6;</a></li></ul><li><span class="title-icon "></span><a href="#flutter&#x7B2C;&#x4E09;&#x65B9;&#x5E93;"><b>2. </b>flutter&#x7B2C;&#x4E09;&#x65B9;&#x5E93;</a></li><ul><li><span class="title-icon "></span><a href="#packageinfo-&#x83B7;&#x53D6;&#x7248;&#x672C;&#x53F7;&#x7B49;"><b>2.1. </b>package_info &#x83B7;&#x53D6;&#x7248;&#x672C;&#x53F7;&#x7B49;</a></li><li><span class="title-icon "></span><a href="#urllauncher"><b>2.2. </b>url_launcher</a></li><li><span class="title-icon "></span><a href="#flutterbloc"><b>2.3. </b>flutter_bloc</a></li><li><span class="title-icon "></span><a href="#sharedpreferences"><b>2.4. </b>shared_preferences</a></li><li><span class="title-icon "></span><a href="#dio"><b>2.5. </b>dio</a></li><li><span class="title-icon "></span><a href="#eventbus"><b>2.6. </b>event_bus</a></li><li><span class="title-icon "></span><a href="#flutterscreenutil"><b>2.7. </b>flutter_screenutil</a></li><li><span class="title-icon "></span><a href="#modalbottomsheet"><b>2.8. </b>modal_bottom_sheet</a></li><li><span class="title-icon "></span><a href="#pathdrawing"><b>2.9. </b>path_drawing</a></li><li><span class="title-icon "></span><a href="#toast"><b>2.10. </b>toast</a></li><li><span class="title-icon "></span><a href="#fluttertts"><b>2.11. </b>flutter_tts</a></li><li><span class="title-icon "></span><a href="#otaupdate"><b>2.12. </b>ota_update</a></li><li><span class="title-icon "></span><a href="#cupertinoicons"><b>2.13. </b>cupertino_icons</a></li><li><span class="title-icon "></span><a href="#equatable"><b>2.14. </b>equatable</a></li></ul><li><span class="title-icon "></span><a href="#dart-&#x8BED;&#x6CD5;"><b>3. </b>dart &#x8BED;&#x6CD5;</a></li><ul><li><span class="title-icon "></span><a href="#&#x80D6;&#x7BAD;&#x5934;&#x8BED;&#x6CD5;"><b>3.1. </b>&#x80D6;&#x7BAD;&#x5934;&#x8BED;&#x6CD5;</a></li><li><span class="title-icon "></span><a href="#&#x53EF;&#x89C1;&#x6027;"><b>3.2. </b>&#x53EF;&#x89C1;&#x6027;</a></li><li><span class="title-icon "></span><a href="#final-&#x3001;const"><b>3.3. </b>final &#x3001;const</a></li><li><span class="title-icon "></span><a href="#&#x6570;&#x5B57;&#x7C7B;&#x578B;"><b>3.4. </b>&#x6570;&#x5B57;&#x7C7B;&#x578B;</a></li><li><span class="title-icon "></span><a href="#&#x53D8;&#x91CF;-&#x7684;&#x521D;&#x59CB;&#x503C;"><b>3.5. </b>&#x53D8;&#x91CF; &#x7684;&#x521D;&#x59CB;&#x503C;</a></li><li><span class="title-icon "></span><a href="#&#x7C7B;&#x578B;-&#x5224;&#x65AD;-&#x3001;&#x8F6C;&#x6362;"><b>3.6. </b>&#x7C7B;&#x578B; &#x5224;&#x65AD; &#x3001;&#x8F6C;&#x6362;</a></li><li><span class="title-icon "></span><a href="#&#x5B57;&#x7B26;&#x4E32;"><b>3.7. </b>&#x5B57;&#x7B26;&#x4E32;</a></li><li><span class="title-icon "></span><a href="#&#x51FD;&#x6570;"><b>3.8. </b>&#x51FD;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x5217;&#x8868;&#x3001;&#x6570;&#x7EC4;"><b>3.9. </b>&#x5217;&#x8868;&#x3001;&#x6570;&#x7EC4;</a></li><li><span class="title-icon "></span><a href="#&#x6784;&#x9020;&#x51FD;&#x6570;"><b>3.10. </b>&#x6784;&#x9020;&#x51FD;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x95ED;&#x5305;"><b>3.11. </b>&#x95ED;&#x5305;</a></li><li><span class="title-icon "></span><a href="#&#x4E09;&#x76EE;&#x8FD0;&#x7B97;&#x7B26;"><b>3.12. </b>&#x4E09;&#x76EE;&#x8FD0;&#x7B97;&#x7B26;</a></li><li><span class="title-icon "></span><a href="#mixin--&#x7279;&#x6027;"><b>3.13. </b>mixin  &#x7279;&#x6027;</a></li><li><span class="title-icon "></span><a href="#&#x5F02;&#x6B65;&#x51FD;&#x6570;--async--await"><b>3.14. </b>&#x5F02;&#x6B65;&#x51FD;&#x6570;  async  await</a></li><li><span class="title-icon "></span><a href="#&#x751F;&#x6210;&#x5668;"><b>3.15. </b>&#x751F;&#x6210;&#x5668;</a></li><li><span class="title-icon "></span><a href="#call-&#x51FD;&#x6570;"><b>3.16. </b>call &#x51FD;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x591A;&#x8FDB;&#x7A0B;&#x673A;&#x5236;-isolate"><b>3.17. </b>&#x201C;&#x591A;&#x8FDB;&#x7A0B;&#x201D;&#x673A;&#x5236; Isolate</a></li><li><span class="title-icon "></span><a href="#&#x6CE8;&#x89E3;"><b>3.18. </b>&#x6CE8;&#x89E3;</a></li><li><span class="title-icon "></span><a href="#&#x968F;&#x673A;&#x6570;"><b>3.19. </b>&#x968F;&#x673A;&#x6570;</a></li></ul></ul></div><a href="#flutter&#x90E8;&#x5206;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="flutter&#x90E8;&#x5206;"><a name="flutter&#x90E8;&#x5206;" class="anchor-navigation-ex-anchor" href="#flutter&#x90E8;&#x5206;"><i class="fa fa-link" aria-hidden="true"></i></a>1. flutter&#x90E8;&#x5206;</h1>
<h2 id="flutter-&#x914D;&#x7F6E;"><a name="flutter-&#x914D;&#x7F6E;" class="anchor-navigation-ex-anchor" href="#flutter-&#x914D;&#x7F6E;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. flutter &#x914D;&#x7F6E;</h2>
<pre><code class="lang-text">1&#x3001;&#x4FEE;&#x6539;&#x6574;&#x4E2A;&#x5DE5;&#x7A0B;&#x7684;&#x6587;&#x4EF6;&#x5939;&#x540D;&#x5B57;&#xFF0C;  &#x4FEE;&#x6539;&#x540E;&#x9700;&#x8981;&#x5728;&#x5DE5;&#x7A0B;&#x91CC; &#x91CD;&#x65B0;&#x547D;&#x540D;xxx.imld&#x7684;&#x540D;&#x5B57;&#xFF08;&#x4F8B;&#x5982; wk-weather.iml &#xFF09;
2&#x3001;&#x7248;&#x672C;&#x53F7;&#x5728; pubspec.yaml version &#x4E2D;&#x914D;&#x7F6E;  
version: 1.0.20201109+1   1.0.20201109 &#x662F;&#x7248;&#x672C;&#x6807;&#x8BB0; &#xFF0C; 1&#x662F;&#x7248;&#x672C;&#x53F7;
3&#x3001;&#x9690;&#x85CF;&#x53F3;&#x4E0A;&#x89D2; debug &#x6807;&#x8BB0;
debugShowCheckedModeBanner: false,
</code></pre>
<h2 id="your-flutter-application-is-created-using-an-older-version-of-the-android-embedding-its-being-deprecated-in-favor-of-android-embedding-v2"><a name="your-flutter-application-is-created-using-an-older-version-of-the-android-embedding-its-being-deprecated-in-favor-of-android-embedding-v2" class="anchor-navigation-ex-anchor" href="#your-flutter-application-is-created-using-an-older-version-of-the-android-embedding-its-being-deprecated-in-favor-of-android-embedding-v2"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. Your Flutter application is created using an older version of the Android embedding. It&apos;s being deprecated in favor of Android embedding v2</h2>
<pre><code class="lang-text">&#x5728; application &#x6807;&#x7B7E;&#x4E0B; &#x6DFB;&#x52A0;
&lt;meta-data
    android:name=&quot;flutterEmbedding&quot;
    android:value=&quot;2&quot; /&gt;
</code></pre>
<h2 id="&#x7B7E;&#x540D;&#x914D;&#x7F6E;-keystore"><a name="&#x7B7E;&#x540D;&#x914D;&#x7F6E;-keystore" class="anchor-navigation-ex-anchor" href="#&#x7B7E;&#x540D;&#x914D;&#x7F6E;-keystore"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. &#x7B7E;&#x540D;&#x914D;&#x7F6E; keystore</h2>
<pre><code class="lang-text">&#x8DDF;Android &#x5DE5;&#x7A0B; &#x4E00;&#x6837;&#x914D;&#x7F6E;&#x5373;&#x53EF;&#x3002;
</code></pre>
<h2 id="app-&#x663E;&#x793A;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x754C;&#x9762;"><a name="app-&#x663E;&#x793A;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x754C;&#x9762;" class="anchor-navigation-ex-anchor" href="#app-&#x663E;&#x793A;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x754C;&#x9762;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. app &#x663E;&#x793A;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x754C;&#x9762;</h2>
<pre><code class="lang-text">import &apos;package:flutter/rendering.dart&apos;;
void main() {
debugPaintSizeEnabled = true;
runApp(  ) ;
}
</code></pre>
<h2 id="flutter&#x5DE5;&#x7A0B;&#x4E2D;-android&#x90E8;&#x5206;&#x7206;&#x7EA2;"><a name="flutter&#x5DE5;&#x7A0B;&#x4E2D;-android&#x90E8;&#x5206;&#x7206;&#x7EA2;" class="anchor-navigation-ex-anchor" href="#flutter&#x5DE5;&#x7A0B;&#x4E2D;-android&#x90E8;&#x5206;&#x7206;&#x7EA2;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5. flutter&#x5DE5;&#x7A0B;&#x4E2D; Android&#x90E8;&#x5206;&#x7206;&#x7EA2;</h2>
<pre><code class="lang-text">&#x5982;&#x679C;&#x5DE5;&#x7A0B;&#x80FD;&#x6B63;&#x5E38;&#x8FD0;&#x884C;&#xFF0C;&#x8BF7;&#x4E0D;&#x8981;&#x7406;&#x4F1A;&#x3002;
&#x7F16;&#x5199;Android&#x90E8;&#x5206;&#x4EE3;&#x7801;&#x65F6;&#x4F60;&#x91CD;&#x65B0;&#x7528;Androidstudio&#x6253;&#x5F00;Android&#x90E8;&#x5206;&#x5373;&#x53EF;&#xFF0C;&#x5B83;&#x4E5F;&#x662F;&#x4E00;&#x4E2A;Android&#x5DE5;&#x7A0B;&#x3002;

// &#x5982;&#x679C;&#x662F; build.gradle &#x4E2D; Properties &#x3001;GradleException  &#x7206;&#x7EA2; 
&#x6309;&#x7167;&#x63D0;&#x793A;&#x5F15;&#x5165; sdk &#xFF0C;&#x5E76;&#x5C06; GradleException &#x6539;&#x6210; Exception &#xFF0C;&#x7136;&#x540E;&#x91CD;&#x65B0;&#x5237;&#x65B0;&#x5DE5;&#x7A0B;&#x5373;&#x53EF;&#x3002;
</code></pre>
<h2 id="flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;-android&#x9879;&#x76EE;&#x90E8;&#x5206;&#x7206;&#x7EA2;"><a name="flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;-android&#x9879;&#x76EE;&#x90E8;&#x5206;&#x7206;&#x7EA2;" class="anchor-navigation-ex-anchor" href="#flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;-android&#x9879;&#x76EE;&#x90E8;&#x5206;&#x7206;&#x7EA2;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6. flutter &#x63D2;&#x4EF6;&#x5F00;&#x53D1; Android&#x9879;&#x76EE;&#x90E8;&#x5206;&#x7206;&#x7EA2;</h2>
<pre><code class="lang-text">&#x5728;Android&#x7684; build.gradle&#x4E0B;&#x52A0;&#x5165;&#x4EE5;&#x4E0B;&#x914D;&#x7F6E;&#xFF0C;&#x5F15;&#x5165; flutter.jar&#x5373;&#x53EF;&#x3002;
//&#x83B7;&#x53D6;local.properties&#x914D;&#x7F6E;&#x6587;&#x4EF6;
def localProperties = new Properties()
def localPropertiesFile = rootProject.file(&apos;local.properties&apos;)
if (localPropertiesFile.exists()) {
 localPropertiesFile.withReader(&apos;UTF-8&apos;) { reader -&gt;
     localProperties.load(reader)
 }
}
//&#x83B7;&#x53D6;flutter&#x7684;sdk&#x8DEF;&#x5F84;
def flutterRoot = localProperties.getProperty(&apos;flutter.sdk&apos;)
if (flutterRoot == null) {
 throw new GradleException(&quot;Flutter SDK not found. Define location with flutter.sdk in the local.properties file.&quot;)
}

dependencies {
 compileOnly files(&quot;$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar&quot;)
}
</code></pre>
<h2 id="flutter-bloc-&#x6A21;&#x5F0F;"><a name="flutter-bloc-&#x6A21;&#x5F0F;" class="anchor-navigation-ex-anchor" href="#flutter-bloc-&#x6A21;&#x5F0F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.7. flutter BloC &#x6A21;&#x5F0F;</h2>
<pre><code class="lang-text">&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x7EC4;&#x4EF6; &#xFF08;Business Logic Component &#xFF09;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;BloC&#x8BBE;&#x8BA1;&#x6A21;&#x5F0F;&#xFF0C;&#x4F3C;&#x4E4E;&#x548C;MVP&#x6CA1;&#x6709;&#x4EC0;&#x4E48;&#x672C;&#x8D28;&#x533A;&#x522B;&#xFF0C;
&#x4E24;&#x79CD;&#x8BBE;&#x8BA1;&#x6A21;&#x5F0F;&#x7684;&#x6700;&#x7EC8;&#x76EE;&#x7684;&#x5C31;&#x662F;&#x4E3A;&#x4E86;&#x628A;&#x548C;UI&#x7CC5;&#x5408;&#x5728;&#x4E00;&#x8D77;&#x7684;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x4EE3;&#x7801;&#x5265;&#x79BB;&#x5F00;&#x6765;&#xFF0C;&#x5355;&#x72EC;&#x7684;&#x62BD;&#x53D6;&#x5230;&#x4E00;&#x5C42;&#x4E2D;&#x3002;
</code></pre>
<h2 id="&#x9879;&#x76EE;&#x7C7B;&#x578B;"><a name="&#x9879;&#x76EE;&#x7C7B;&#x578B;" class="anchor-navigation-ex-anchor" href="#&#x9879;&#x76EE;&#x7C7B;&#x578B;"><i class="fa fa-link" aria-hidden="true"></i></a>1.8. &#x9879;&#x76EE;&#x7C7B;&#x578B;</h2>
<h3 id="flutter-application"><a name="flutter-application" class="anchor-navigation-ex-anchor" href="#flutter-application"><i class="fa fa-link" aria-hidden="true"></i></a>1.8.1. Flutter Application</h3>
<pre><code class="lang-text">Flutter Application &#x8868;&#x793A;&#x4E00;&#x4E2A;Flutter&#x9879;&#x76EE;&#xFF0C;&#x4E3B;&#x4F53;&#x662F;Flutter&#xFF0C;
&#x5F53;&#x7136;&#x5B83;&#x4E5F;&#x53EF;&#x4EE5;&#x63A5;&#x5165;Android Module &#x6216;&#x8005; iOS Framework&#xFF0C;
&#x5176;&#x5185;&#x90E8;&#x5305;&#x542B; Android &#x548C; iOS &#x9879;&#x76EE;&#x3002;&#x4EE5;&#x540E;&#x53EF;&#x80FD;&#x4F1A;&#x652F;&#x6301;&#x5176;&#x4ED6;&#x5E73;&#x53F0;&#x3002;
</code></pre>
<h3 id="flutter-plugin"><a name="flutter-plugin" class="anchor-navigation-ex-anchor" href="#flutter-plugin"><i class="fa fa-link" aria-hidden="true"></i></a>1.8.2. Flutter Plugin</h3>
<pre><code class="lang-text">Flutter Plugin &#x8868;&#x793A; Flutter &#x63D2;&#x4EF6;&#xFF0C;&#x5305;&#x542B; Android &#x548C; iOS &#x9879;&#x76EE;&#xFF0C;
&#x5982;&#x679C;&#x4F60;&#x8981;&#x5F00;&#x53D1;&#x4E00;&#x4E2A; Plugin &#x4E14;&#x6B64; Plugin &#x6D89;&#x53CA;&#x5230;&#x539F;&#x751F;&#x652F;&#x6301;&#xFF0C;&#x6BD4;&#x5982;&#x84DD;&#x7259;&#x529F;&#x80FD;&#x3001;&#x7F51;&#x7EDC;&#x529F;&#x80FD;&#x7B49;&#xFF0C;
&#x8FD9;&#x4E9B;&#x529F;&#x80FD;&#x7EAF; Flutter &#x662F;&#x65E0;&#x6CD5;&#x5B9E;&#x73B0;&#x7684;&#x3002;
Flutter Plugin &#x5F00;&#x53D1;&#x5B8C;&#x6210;&#x540E;&#x53EF;&#x4EE5;&#x53D1;&#x5E03;&#x5230; pub &#x4E0A;&#x3002;
</code></pre>
<h3 id="flutter-package"><a name="flutter-package" class="anchor-navigation-ex-anchor" href="#flutter-package"><i class="fa fa-link" aria-hidden="true"></i></a>1.8.3. Flutter Package</h3>
<pre><code class="lang-text">Flutter Package &#x548C; Flutter Plugin &#x57FA;&#x672C;&#x4E00;&#x6837;&#xFF0C;&#x552F;&#x4E00;&#x7684;&#x533A;&#x522B;&#x662F;Flutter Package&#x8868;&#x793A;&#x7EAF; Flutter &#x6A21;&#x5757;&#xFF0C;
&#x4E0D;&#x9700;&#x8981;&#x539F;&#x751F;&#x5F00;&#x53D1;&#xFF0C;&#x6CA1;&#x6709;Android &#x548C; iOS &#x9879;&#x76EE;&#xFF0C;&#x6BD4;&#x5982;&#x5F00;&#x53D1;&#x4E00;&#x4E2A;&#x7EAF; UI &#x7684;&#x63D2;&#x4EF6;&#x3002;
</code></pre>
<h3 id="flutter-module"><a name="flutter-module" class="anchor-navigation-ex-anchor" href="#flutter-module"><i class="fa fa-link" aria-hidden="true"></i></a>1.8.4. Flutter Module</h3>
<pre><code class="lang-text">Flutter Module &#x7528;&#x4E8E;&#x539F;&#x751F;&#x9879;&#x76EE;&#x4E2D;&#x63D2;&#x5165; Flutter &#x6A21;&#x5757;&#xFF0C;&#x539F;&#x751F;&#x4E3A;&#x4E3B;&#x4F53;&#xFF0C;&#x4E0E; Flutter &#x8FDB;&#x884C;&#x6DF7;&#x5408;&#x5F00;&#x53D1;&#x3002;
</code></pre>
<h2 id="json"><a name="json" class="anchor-navigation-ex-anchor" href="#json"><i class="fa fa-link" aria-hidden="true"></i></a>1.9. json</h2>
<pre><code class="lang-text">// &#x4E3E;&#x4F8B;&#x4F7F;&#x7528;
// json.decode(modelStr)
// Parses the string and returns the resulting Json object

//  json obj &#x8F6C;&#x5BF9;&#x8C61;
WeatherModelEntity weatherModelEntity = WeatherModelEntity().fromJson(json.decode(modelStr));

------------------
json&#x90E8;&#x5206;&#x7684;&#x4EE3;&#x7801;&#x4F7F;&#x7528; FlutterJsonBeanFactory &#x63D2;&#x4EF6;&#x751F;&#x6210;&#x7684; &#x3002;
https://plugins.jetbrains.com/plugin/11415-flutterjsonbeanfactory

&#x5982;&#x679C;&#x6539;&#x53D8;&#x4E86;&#x7ED3;&#x6784;&#xFF0C;&#x9700;&#x8981;&#x5728;&#x53D8;&#x52A8;&#x8FC7;&#x7684;&#x6587;&#x4EF6;&#x4E0A; alt+ j &#x91CD;&#x65B0;&#x751F;&#x6210; json_convert_content.dart

------------------
1&#x3001;&#x5C06; json &#x5B57;&#x7B26;&#x4E32;&#x8F6C;&#x4E3A; map &#x683C;&#x5F0F;&#x7684;json &#x5BF9;&#x8C61; 
import &apos;dart:convert&apos;; //&#x7CFB;&#x7EDF;&#x81EA;&#x5E26;

2&#x3001;&#x5C06; json &#x5BF9;&#x8C61;&#x8F6C;&#x4E3A; &#x5B9E;&#x4F53;&#x7C7B;&#x5BF9;&#x8C61; 
&#x501F;&#x52A9;&#x7B2C;&#x4E09;&#x65B9;&#x5DE5;&#x5177; FlutterJsonBeanFactory &#x7B80;&#x5316;&#x4EBA;&#x5DE5;&#x4EE3;&#x7801;
</code></pre>
<h2 id="&#x56FD;&#x9645;&#x5316;-&#x7FFB;&#x8BD1;&#x652F;&#x6301;"><a name="&#x56FD;&#x9645;&#x5316;-&#x7FFB;&#x8BD1;&#x652F;&#x6301;" class="anchor-navigation-ex-anchor" href="#&#x56FD;&#x9645;&#x5316;-&#x7FFB;&#x8BD1;&#x652F;&#x6301;"><i class="fa fa-link" aria-hidden="true"></i></a>1.10. &#x56FD;&#x9645;&#x5316; &#x7FFB;&#x8BD1;&#x652F;&#x6301;</h2>
<h3 id="&#x7CFB;&#x7EDF;&#x81EA;&#x5E26;&#x7684;&#x63A7;&#x4EF6;-&#x56FD;&#x9645;&#x5316;"><a name="&#x7CFB;&#x7EDF;&#x81EA;&#x5E26;&#x7684;&#x63A7;&#x4EF6;-&#x56FD;&#x9645;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x7CFB;&#x7EDF;&#x81EA;&#x5E26;&#x7684;&#x63A7;&#x4EF6;-&#x56FD;&#x9645;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>1.10.1. &#x7CFB;&#x7EDF;&#x81EA;&#x5E26;&#x7684;&#x63A7;&#x4EF6; &#x56FD;&#x9645;&#x5316;</h3>
<p>Flutter&#x7ED9;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x7684;Widget&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x5C31;&#x662F;&#x652F;&#x6301;&#x56FD;&#x9645;&#x5316;&#x3002;&#x4F8B;&#x5982;&#x65F6;&#x95F4;&#x65E5;&#x671F;&#x9009;&#x62E9;&#x63A7;&#x4EF6;&#x3002;</p>
<pre><code class="lang-text">1&#x3001; pubspec.yaml&#x4E2D;&#x65B0;&#x589E;&#x914D;&#x7F6E;
flutter_localizations:# &#x56FD;&#x9645;&#x5316;&#x652F;&#x6301; &#x5305;
 sdk: flutter

2&#x3001; &#x5BF9; MaterialApp &#x8FDB;&#x884C;&#x914D;&#x7F6E;
return MaterialApp(
title: &apos;Flutter Demo&apos;,
// localizationsDelegates &#x6307;&#x5B9A;&#x54EA;&#x4E9B;Widget&#x9700;&#x8981;&#x8FDB;&#x884C;&#x56FD;&#x9645;&#x5316;
localizationsDelegates: [
 GlobalMaterialLocalizations.delegate, // Material
 GlobalCupertinoLocalizations.delegate, // Cupertino
 GlobalWidgetsLocalizations.delegate // Widgets
],
//  supportedLocales &#x652F;&#x6301;&#x54EA;&#x4E9B; &#x8BED;&#x8A00;
supportedLocales: [
 Locale(&quot;en&quot;),
 Locale(&quot;zh&quot;)
],
</code></pre>
<h3 id="&#x81EA;&#x5B9A;&#x4E49;&#x63A7;&#x4EF6;&#x3001;&#x6587;&#x672C;&#x3001;&#x4FE1;&#x606F;&#x5C55;&#x793A;-&#x56FD;&#x9645;&#x5316;"><a name="&#x81EA;&#x5B9A;&#x4E49;&#x63A7;&#x4EF6;&#x3001;&#x6587;&#x672C;&#x3001;&#x4FE1;&#x606F;&#x5C55;&#x793A;-&#x56FD;&#x9645;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x81EA;&#x5B9A;&#x4E49;&#x63A7;&#x4EF6;&#x3001;&#x6587;&#x672C;&#x3001;&#x4FE1;&#x606F;&#x5C55;&#x793A;-&#x56FD;&#x9645;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>1.10.2. &#x81EA;&#x5B9A;&#x4E49;&#x63A7;&#x4EF6;&#x3001;&#x6587;&#x672C;&#x3001;&#x4FE1;&#x606F;&#x5C55;&#x793A; &#x56FD;&#x9645;&#x5316;</h3>
<p>&#x5927;&#x90E8;&#x5206;&#x60C5;&#x51B5;&#xFF0C;&#x662F;&#x9700;&#x8981;&#x5BF9;&#x81EA;&#x5B9A;&#x4E49;&#x7684;&#x63A7;&#x4EF6;&#x6216;&#x4FE1;&#x606F;&#x7B49;&#x8FDB;&#x884C;&#x56FD;&#x9645;&#x5316;&#x3002;</p>
<pre><code class="lang-text">&#x4E3A;&#x4E86;&#x65B9;&#x4FBF;&#x5FEB;&#x901F;&#xFF0C;&#x4E00;&#x822C;&#x4F7F;&#x7528;&#x7B2C;&#x4E09;&#x65B9;&#x63D2;&#x4EF6; Flutter intl  &#x8FDB;&#x884C;&#x914D;&#x7F6E;&#x3002;

1&#x3001;&#x5B89;&#x88C5;&#x63D2;&#x4EF6;&#xFF0C;&#x91CD;&#x542F; Androidstudio
2&#x3001; pubspec.yaml&#x4E2D;&#x65B0;&#x589E;&#x914D;&#x7F6E;
flutter_localizations:# &#x56FD;&#x9645;&#x5316;&#x652F;&#x6301; &#x5305;
 sdk: flutter
3&#x3001;&#x5728;Tools&#x680F;&#x76EE;&#x4E0B;&#x627E;&#x5230; Flutter Intl &#x8FDB;&#x884C;&#x521D;&#x59CB;&#x5316;&#x3002;
&#x521D;&#x59CB;&#x5316;&#x540E; &#xFF0C;
pubspec.yaml &#x4E2D;&#x4F1A;&#x65B0;&#x589E;&#x914D;&#x7F6E; flutter_intl:  enabled: true
lib &#x76EE;&#x5F55;&#x4E0B; &#x4F1A;&#x65B0;&#x589E; generated &#x3001;l10n&#x6587;&#x4EF6;&#x5939;

4&#x3001;&#x5728;Tools&#x680F;&#x76EE;&#x4E0B;&#x627E;&#x5230; Flutter Intl &#x6DFB;&#x52A0;&#x8BED;&#x8A00;&#x652F;&#x6301; &#xFF0C;&#x4F8B;&#x5982; en_IN, zh_CN, de_DE
5&#x3001;&#x5728; l10n &#x76EE;&#x5F55;&#x4E0B; &#x627E;&#x5230;&#x5BF9;&#x5E94;&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x8FDB;&#x884C;&#x8BED;&#x8A00;&#x914D;&#x7F6E; &#xFF0C;&#x4F8B;&#x5982;
{
  &quot;string_title&quot;: &quot;&#x6D4B;&#x8BD5;&#x6807;&#x9898;&quot; ,
  &quot;string_Name&quot;: &quot;&#x6D4B;&#x8BD5;&#x540D;&#x5B57;&quot;
}

6&#x3001; &#x5728; MaterialApp &#x4E2D;&#x8FDB;&#x884C;&#x591A;&#x8BED;&#x8A00;&#x652F;&#x6301;&#x914D;&#x7F6E; &#x3002;
return MaterialApp(
title: &quot;123123&quot;, // &#x5FEB;&#x7167;&#x4E0A;&#x663E;&#x793A;&#x7684;APP&#x540D;&#x5B57;
// title: S.of(context).string_title, // &#x8FD9;&#x91CC;&#x4F7F;&#x7528;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;
localizationsDelegates: const [
 S.delegate,
 GlobalMaterialLocalizations.delegate,
 GlobalCupertinoLocalizations.delegate,
 GlobalWidgetsLocalizations.delegate
],
supportedLocales: S.delegate.supportedLocales,
localeListResolutionCallback: (locales, supportedLocales) {
 // &#x8BBE;&#x5907;&#x652F;&#x6301;&#x7684;&#x8BED;&#x8A00;
 print(&quot;---------$locales&quot;);
 return;
},

7&#x3001;&#x4F7F;&#x7528;
Text( S.of(context).string_title )  // S&#x662F;&#x81EA;&#x5B9A;&#x751F;&#x6210;&#x7684;&#x4EE3;&#x7801;&#x5B9A;&#x4E49;&#x7684;&#x7C7B;&#x540D;
Text( S.current.string_title )
</code></pre>
<h2 id="&#x5C4F;&#x5E55;&#x9002;&#x914D;"><a name="&#x5C4F;&#x5E55;&#x9002;&#x914D;" class="anchor-navigation-ex-anchor" href="#&#x5C4F;&#x5E55;&#x9002;&#x914D;"><i class="fa fa-link" aria-hidden="true"></i></a>1.11. &#x5C4F;&#x5E55;&#x9002;&#x914D;</h2>
<pre><code class="lang-text">final mediaQueryData = MediaQuery.of(context);
// &#x903B;&#x8F91;&#x5BBD;&#x9AD8;
final screenWidth = mediaQueryData.size.width;
final screenHeight = mediaQueryData.size.height;
// &#x7269;&#x7406;&#x5BBD;&#x9AD8;&#x3001;&#x5206;&#x8FA8;&#x7387;
final physicalWidth = window.physicalSize.width; // import &apos;dart:ui&apos;;
final physicalHeight = window.physicalSize.height;
// &#x5BC6;&#x5EA6;
final dpr = window.devicePixelRatio;
// &#x72B6;&#x6001;&#x680F;&#x9AD8;&#x5EA6;
final statusBarHeight = mediaQueryData.padding.top;
// &#x5E95;&#x90E8;&#x9AD8;&#x5EA6;
final bottomHeight = mediaQueryData.padding.bottom;

flutter&#x7684;&#x957F;&#x5EA6;&#x5355;&#x4F4D;&#x662F; dp &#xFF0C;&#x800C;&#x4E0D;&#x662F;px ,&#x9002;&#x914D;&#x65B9;&#x6848;&#x53C2;&#x8003;Android&#x7684;&#x9002;&#x914D;&#x7ECF;&#x9A8C;&#x5373;&#x53EF;&#x3002;

&#x65E0;&#x8BBA;&#x8BBE;&#x8BA1;&#x7A3F;&#x7684;&#x5355;&#x4F4D;&#x662F;px,&#x6216;&#x8005;&#x662F;dp,&#x6211;&#x4EEC;&#x90FD;&#x80FD;&#x591F;&#x8F6C;&#x6362;&#x6210;px&#x3002;
1&#x3001;&#x5148;&#x5C06;&#x8BBE;&#x8BA1;&#x7A3F;&#x6362;&#x6210; dp&#x4E3A;&#x5355;&#x4F4D;&#x7684;&#x8BBE;&#x8BA1;&#x7A3F;
&#x4F8B;&#x5982; 1920 * 1080   ( px )
2&#x3001;&#x8F6C;&#x6362;&#x539F;&#x7406;(&#x6BD4;&#x4F8B;&#x4E00;&#x6837;)&#x5982;&#x56FE;.
</code></pre>
<p><img src="../pics/&#x9002;&#x914D;&#x65B9;&#x6848;.png" alt=""></p>
<h2 id="flutter-&#x8FD0;&#x884C;&#x6A21;&#x5F0F;"><a name="flutter-&#x8FD0;&#x884C;&#x6A21;&#x5F0F;" class="anchor-navigation-ex-anchor" href="#flutter-&#x8FD0;&#x884C;&#x6A21;&#x5F0F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.12. flutter &#x8FD0;&#x884C;&#x6A21;&#x5F0F;</h2>
<pre><code class="lang-text">release  //&#x53D1;&#x5E03;&#x6A21;&#x5F0F;
profile // &#x6027;&#x80FD;&#x6A21;&#x5F0F;
debug  // &#x8C03;&#x8BD5;&#x6A21;&#x5F0F;

flutter run --release
flutter run --debug

// It&apos;s likely that this file was generated under xxx \build, but the tool couldn&apos;t find it.
&#x8FD9;&#x4E2A;&#x95EE;&#x9898; &#x6211;&#x8FD9;&#x8FB9;&#x5BFC;&#x81F4;&#x7684;&#x539F;&#x56E0;&#x662F; &#x7B7E;&#x540D;&#x4FE1;&#x606F;&#x914D;&#x7F6E;&#x9519;&#x4E86; &#xFF0C; &#x4E0D;&#x80FD;&#x6539;&#x6210; wk2017&#x4E4B;&#x7C7B;&#x7684; &#xFF0C; &#x8981;&#x7528; release &#x6216;&#x8005;debug &#xFF0C; &#x6216;&#x8005;&#x5E72;&#x8106;&#x4E0D;&#x8981;&#x7B7E;&#x540D;&#x3002;

Androidstudio &#x83DC;&#x5355;&#x4E0B;&#x7684; Flutter fun xxx.dart in release/profile mode &#x3002;
</code></pre>
<h2 id="&#x72B6;&#x6001;&#x7BA1;&#x7406;"><a name="&#x72B6;&#x6001;&#x7BA1;&#x7406;" class="anchor-navigation-ex-anchor" href="#&#x72B6;&#x6001;&#x7BA1;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>1.13. &#x72B6;&#x6001;&#x7BA1;&#x7406;</h2>
<pre><code class="lang-text">1&#x3001;&#x6DFB;&#x52A0;&#x652F;&#x6301; provider: ^4.3.2+2
https://pub.flutter-io.cn/packages/provider/install

2&#x3001;&#x5B9A;&#x4E49;&#x5171;&#x4EAB;&#x6570;&#x636E;&#x7C7B; xxx extends ChangeNotifier
notifyListeners(); // &#x901A;&#x77E5;&#x5237;&#x65B0;

3&#x3001;ChangeNotifierProvider &#x5C06;&#x6570;&#x636E;&#x5171;&#x4EAB;&#x7C7B; &#x548C; widget &#x5173;&#x8054;&#x8D77;&#x6765;
Widget someWidget = ChangeNotifierProvider&lt;GlobalModel&gt;(
   create: (context) =&gt; GlobalModel(), //  ChangeNotifier
   child: child, // Widget
 );

4&#x3001;&#x66F4;&#x65B0;&#x6570;&#x636E;
var shareBean = Provider.of&lt;XXX&gt;(context); // &#x5982;&#x679C; Widget &#x548C;  ChangeNotifier &#x6CA1;&#x6709;&#x5173;&#x8054;&#x8FC7;&#xFF0C;&#x662F;&#x4E0D;&#x662F;&#x5C31;&#x662F;null&#xFF1F;
shareBean.xxx = &quot;abc&quot; // &#x66F4;&#x65B0;&#x6570;&#x636E;
</code></pre>
<h2 id="&#x5F15;&#x5165;&#x672C;&#x5730;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;"><a name="&#x5F15;&#x5165;&#x672C;&#x5730;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;" class="anchor-navigation-ex-anchor" href="#&#x5F15;&#x5165;&#x672C;&#x5730;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;"><i class="fa fa-link" aria-hidden="true"></i></a>1.14. &#x5F15;&#x5165;&#x672C;&#x5730;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;</h2>
<pre><code class="lang-text">1&#x3001;&#x5728;&#x5DE5;&#x7A0B;&#x76EE;&#x5F55;&#x4E0B;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;&#x5939;&#x5B58;&#x653E;&#x63D2;&#x4EF6;&#xFF0C;&#x6BD4;&#x5982;plugin
2&#x3001;&#x6253;&#x5F00;&#x5DE5;&#x7A0B;&#x7684;pubspec.yaml&#xFF0C;&#x5728;dependence&#x91CC;&#x6DFB;&#x52A0;plugin&#x4E0B;&#x7684;&#x63D2;&#x4EF6;
//&#x672C;&#x5730;&#x63D2;&#x4EF6;&#x5F15;&#x7528; &#x6CE8;&#x610F;&#x7F29;&#x8FDB;&#x683C;&#x5F0F;
webview_flutter:
 path: plugin/webview_flutter
</code></pre>
<h2 id="flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;"><a name="flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;" class="anchor-navigation-ex-anchor" href="#flutter-&#x63D2;&#x4EF6;&#x5F00;&#x53D1;"><i class="fa fa-link" aria-hidden="true"></i></a>1.15. flutter &#x63D2;&#x4EF6;&#x5F00;&#x53D1;</h2>
<pre><code class="lang-text">1&#x3001;&#x65B0;&#x5EFA;&#x63D2;&#x4EF6;&#x5DE5;&#x7A0B;
2&#x3001;&#x8C03;&#x7528;&#x8005;&#x4E2D; &#x5F15;&#x5165;&#x63D2;&#x4EF6;&#x5730;&#x5740;
wk_flutter_plugin:
 path: wk_flutter_plugin # &#x672C;&#x5730;flutter&#x63D2;&#x4EF6;&#x5E93; msg_plugin
</code></pre>
<h2 id="flutter-&#x4E0E;-android-&#x6570;&#x636E;-&#x4EA4;&#x4E92;"><a name="flutter-&#x4E0E;-android-&#x6570;&#x636E;-&#x4EA4;&#x4E92;" class="anchor-navigation-ex-anchor" href="#flutter-&#x4E0E;-android-&#x6570;&#x636E;-&#x4EA4;&#x4E92;"><i class="fa fa-link" aria-hidden="true"></i></a>1.16. flutter &#x4E0E; Android &#x6570;&#x636E; &#x4EA4;&#x4E92;</h2>
<p>&#x6709;&#x4E9B;&#x529F;&#x80FD;&#xFF0C;flutter&#x6682;&#x65F6;&#x4E0D;&#x652F;&#x6301;(&#x4F8B;&#x5982;&#x84DD;&#x7259;)&#xFF0C;&#x6240;&#x4EE5;&#x9700;&#x8981;&#x7528;Android&#x5F00;&#x53D1;&#x83B7;&#x5F97;&#x6570;&#x636E;&#xFF0C;&#x7136;&#x540E;&#x4F20;&#x9012;&#x7ED9;&#x84DD;&#x7259;&#x3002;</p>
<pre><code class="lang-text">flutter&#x548C;Android&#x901A;&#x4FE1;&#x7684;&#x65B9;&#x5F0F;&#x76EE;&#x524D;&#x4E3B;&#x8981;&#x53EF;&#x4EE5;&#x91C7;&#x7528;
MethodChannel // flutter&#x8C03;&#x7528;&#x65B9;&#x6CD5;&#xFF0C;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#xFF0C;&#x4E00;&#x95EE;&#x4E00;&#x7B54;&#x6A21;&#x5F0F;
EventChannel // Android&#x7AEF;&#x4E0D;&#x65AD;&#x5F80;flutter&#x53D1;&#x9001;&#x6570;&#x636E; &#xFF0C;&#x5355;&#x5411;?
BasicMessageChannel // &#x53CC;&#x5411;&#x901A;&#x4FE1;

&#x6CE8;&#x610F;&#xFF1A;&#x65B0;&#x5EFA;&#x901A;&#x9053;&#x5BF9;&#x8C61;&#x65F6; &#xFF0C;flutter &#x548C; Android &#x7AEF;&#xFF0C;name &#x53C2;&#x6570;&#x662F;&#x5BF9;&#x5E94;&#x7684;&#xFF0C;

public class MainActivity extends FlutterActivity  implements MethodChannel.MethodCallHandler {
 int count = 0;
 @Override
 protected void onCreate( ... ) {
     super.onCreate(savedInstanceState);
     Activity activity = this ;

     new Thread(new Runnable() {
         @Override
         public void run() {
             while(true){
                 try {
                     Thread.sleep(500);
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }

                 if(eventSink==null){
                     WkLog.showLog(&quot;myEvent ==null&quot;);
                 }else{
                     count ++ ;
                     activity.runOnUiThread(new Runnable() {
                         @Override
                         public void run() {
                             if(count%2==0){
                                 eventSink.success(&quot;hello android...&quot;+count);
                             }else{
                                 eventSink.error(&quot;500&quot; ,&quot;&#x53D1;&#x751F;&#x5F02;&#x5E38;&quot; ,null);
                             }
                         }
                     });
                 }


                 if(basicMessageChannel!=null){
                     activity.runOnUiThread(new Runnable() {
                         @Override
                         public void run() {
                            basicMessageChannel.send(&quot;Android&#x4E3B;&#x52A8;&#x53D1;&#x9001;&#x6D88;&#x606F; &quot; + count);
                         }
                     });

                 }else{
                     WkLog.showLog(&quot;basicMessageChannel ==null&quot;);
                 }


             }
         }
     }).start();
 }

 private final String KEY_METHODCHANNEL =&quot;KEY_METHODCHANNEL_20201124&quot; ;
 private final String KEY_EventChannel =&quot;KEY_EventChannel_20201124&quot; ;
 private final String KEY_BasicMessageChannel =&quot;BasicMessageChannel_20201124&quot; ;
 private MethodChannel methodChannel;
 private  EventChannel.EventSink eventSink = null ;
 private BasicMessageChannel&lt;String&gt; basicMessageChannel;

 //  configureFlutterEngine &#x51FD;&#x6570; &#x5728; onCreate &#x4E4B;&#x524D;&#x6267;&#x884C;
 @Override
 public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
     super.configureFlutterEngine(flutterEngine);
     initEngineConfig(flutterEngine);
 }

 private void initEngineConfig(FlutterEngine flutterEngine){
     // MethodChannel
     methodChannel = new MethodChannel(flutterEngine.getDartExecutor(), KEY_METHODCHANNEL);
     methodChannel.setMethodCallHandler(this);

     // EventChannel
     EventChannel eventChannel =new EventChannel( flutterEngine.getDartExecutor() ,KEY_EventChannel);
     eventChannel.setStreamHandler( new EventChannel.StreamHandler() {
         @Override
         public void onListen(Object arguments, EventChannel.EventSink events) {
             // events &#x4F20;&#x51FA;&#x53BB;&#xFF0C;&#x7528;&#x6765;&#x4E3B;&#x52A8;&#x53D1;&#x9001;&#x6570;&#x636E;
             eventSink =events ;
         }

         @Override
         public void onCancel(Object arguments) {

         }
     });

     //
     basicMessageChannel = new BasicMessageChannel&lt;String&gt; (  flutterEngine.getDartExecutor() ,
             KEY_BasicMessageChannel, StringCodec.INSTANCE); // StandardMessageCodec.INSTANCE
     basicMessageChannel.setMessageHandler( new BasicMessageChannel.MessageHandler() {
         @Override
         public void onMessage(Object message,  BasicMessageChannel.Reply reply){
             String str =  (String) message;
             WkLog.showLog(&quot;&#x6536;&#x5230;&#x6765;&#x81EA;flutter=&quot;+ str);

         }
     });
 }

 @Override
 public void onMethodCall(MethodCall call, MethodChannel.Result result) {
     if (call.method.equals(&quot;userLogin&quot;)) {
         String hostIp = call.argument(&quot;hostIp&quot;);
         String hostPort = call.argument(&quot;hostPort&quot;);
         result.success(hostIp+ &quot;   &quot;+hostPort + &quot;&#x767B;&#x5F55;&#x6210;&#x529F;...&quot; + System.currentTimeMillis()) ;
     }else {
         result.notImplemented();
     }
 }
}


class MsgTransmissionTool {
static String KEY_METHODCHANNEL =&quot;KEY_METHODCHANNEL_20201124&quot; ;
static String KEY_EventChannel =&quot;KEY_EventChannel_20201124&quot; ;
static String KEY_BasicMessageChannel =&quot;BasicMessageChannel_20201124&quot; ;

static MsgTransmissionTool _instance ;
static MsgTransmissionTool getinstance()  {
 if(_instance ==null){
   _instance = MsgTransmissionTool() ;
 }
 return _instance ;
}

MethodChannel methodChannel ;
EventChannel eventChannel  ;
BasicMessageChannel basicMessageChannel ;
MsgTransmissionTool(){
 // todo &#x91CD;&#x8981;&#x6CE8;&#x91CA;&#xFF1A; &#x8981;&#x5148;&#x5728; flutter&#x7AEF;&#x65B0;&#x5EFA;&#x521D;&#x59CB;&#x5316;&#x8FD9;&#x4E9B;&#x5BF9;&#x8C61;&#xFF0C;&#x5426;&#x5219;Android&#x7AEF;&#x7684;&#x90A3;&#x4E9B;&#x5BF9;&#x8C61;&#x662F;&#x7A7A;&#x7684;&#x3002;
 methodChannel =   MethodChannel(KEY_METHODCHANNEL);
 eventChannel = EventChannel(KEY_EventChannel );
 basicMessageChannel = BasicMessageChannel( KEY_BasicMessageChannel, StringCodec());
 // StandardMessageCodec
}

setMessageHandler(  Future&lt;dynamic&gt; Function( dynamic message)  handler ){
 if(basicMessageChannel!=null){
   basicMessageChannel.setMessageHandler(handler) ;
 }
}

setEnventChannelListener( void onData(dynamic event) ,void _onError(dynamic event) ){
 if(eventChannel!=null){
   eventChannel.receiveBroadcastStream().listen( onData, onError: _onError);
 }
}

void sendMsgByBasicMessageChannel(String msg) async {
 if(basicMessageChannel!=null){
    await basicMessageChannel.send(msg );
 }
}

Future&lt;String&gt; sendMsgByMethodChannel( String hostIp ,String hostPort)  async {
 if(methodChannel!=null){
   final String version =
   // &#x53C2;&#x6570;&#x4EE5;&#x952E;&#x503C;&#x5BF9;&#x7684;&#x65B9;&#x5F0F;&#x4F20;&#x9012;&#x8FC7;&#x53BB;
   await methodChannel.invokeMethod(&apos;userLogin&apos;  , &lt;String,dynamic&gt;{&quot;hostIp&quot;:hostIp , &quot;hostPort&quot;:hostPort});
   return version;
 }else{
   print(&quot;methodChannel ==null&quot;);
 }
 return null ;
}
}
</code></pre>
<pre><code class="lang-text">// &#x4F7F;&#x7528;
// &#x8BBE;&#x7F6E;&#x76D1;&#x542C;&#x51FD;&#x6570;
_initTool() async{
 await MsgTransmissionTool.getinstance().setMessageHandler(  ongetMsgFromMessageChannerl);
 await MsgTransmissionTool.getinstance().setEnventChannelListener(  _onEvent , _onError);
}

void _onEvent(Object event) {
 setState(() {
   msg2 = event ;
 });
 print(&quot;&#x6536;&#x5230;&#x6570;&#x636E;==_onEvent==$event&quot;);
}

void _onError(Object error) {
 PlatformException exception = error ;
 setState(() {
   msg2 = &quot; ${ exception.message} , ${exception.code} &quot;;
 });
 print(&quot;&#x6536;&#x5230;&#x6570;&#x636E;==_onError&quot;);
}

Future&lt;String&gt; ongetMsgFromMessageChannerl( dynamic message)  {
setState(() {
 msg3= message ;
});
}

// &#x5F80;Android&#x53D1;&#x9001;&#x6570;&#x636E;
Future&lt;void&gt; testSend() async {
String  result = await MsgTransmissionTool.getinstance().sendMsgByMethodChannel(&quot;192.168.1.1&quot; ,&quot;8080&quot;);
setState(() {
loginResult=result ;
});

MsgTransmissionTool.getinstance().sendMsgByBasicMessageChannel(&quot;BasicMessageChannel &#x7ED9;Android &#x53D1;&#x9001;&#x6D88;&#x606F;&quot;) ;
}
</code></pre>
<h2 id="flutter-&#x8C03;&#x7528;android&#x63A7;&#x4EF6;"><a name="flutter-&#x8C03;&#x7528;android&#x63A7;&#x4EF6;" class="anchor-navigation-ex-anchor" href="#flutter-&#x8C03;&#x7528;android&#x63A7;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a>1.17. flutter &#x8C03;&#x7528;Android&#x63A7;&#x4EF6;</h2>
<pre><code class="lang-text">// Android &#x7AEF; &#x65B0;&#x5EFA; View &#x548C;&#x5DE5;&#x5382;&#x7C7B;
class MyView implements PlatformView {
 private TextView textView;

 MyView(Context context ) {
     // configureFlutterEngine &#x51FD;&#x6570; &#x5728; onCreate &#x4E4B;&#x524D;&#x6267;&#x884C; &#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x80FD;&#x901A;&#x8FC7; findViewById &#x65B9;&#x5F0F;&#x83B7;&#x5F97;&#x63A7;&#x4EF6;
     //View rootView = inflater.inflate(R.layout.testlayout, null);
     //rootView.findViewById()
     TextView myNativeView = new TextView(context);
     myNativeView.setTextColor(Color.RED);
     myNativeView.setClickable(true);
     myNativeView.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View view) {
             textView.setTextColor(Color.BLUE);
             Toast.makeText(context ,&quot;hello android&quot; ,Toast.LENGTH_SHORT).show();
         }
     });
     this.textView = myNativeView;
 }

 public void updateValue(String value){
     textView.setTextColor(Color.RED);
     textView.setText(&quot;----&gt; &quot;+value);
 }

 @Override
 public View getView() {
     return textView;
 }

 @Override
 public void dispose() {  }
}

public class MyViewFactory extends PlatformViewFactory {
 private MyView myView ;
 public MyViewFactory( ) {
     super(StandardMessageCodec.INSTANCE);
 }

 @Override
 public PlatformView create(Context context, int id, Object args) {
     myView = new MyView(context) ;
     // &#x65B0;&#x5EFA;&#x65F6; &#x4F20;&#x9012;&#x8FC7;&#x6765;&#x7684;&#x53C2;&#x6570;
     Map&lt;String ,String&gt; params = (Map&lt;String, String&gt;) args;
     String value = params.get(&quot;key123456&quot;) ;
     myView.updateValue(value);
     return myView;
 }
}

//  &#x5728;XXActivity&#x4E2D;  &#x6CE8;&#x518C;&#x8FD9;&#x4E2A;&#x63A7;&#x4EF6;
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
 super.configureFlutterEngine(flutterEngine);
 PlatformViewRegistry registry = flutterEngine.getPlatformViewsController().getRegistry() ;
 myViewFactory =   new MyViewFactory() ;
 // platform_text_view12345678 &#x662F;&#x5168;&#x5C40;&#x552F;&#x4E00;&#x7684;&#xFF0C;&#x8981;&#x4E0E;flutter&#x7AEF;&#x5BF9;&#x5E94;&#x4F7F;&#x7528;
 registry.registerViewFactory(&quot;platform_text_view12345678&quot;,myViewFactory) ;
}

// flutter&#x7AEF; &#x901A;&#x8FC7; AndroidView &#x6765;&#x5305;&#x88F9;&#x8C03;&#x7528;
var androidView  =  AndroidView(
 viewType: &quot;platform_text_view12345678&quot;,
 creationParams: &lt;String, dynamic&gt;{&quot;key123456&quot;: &quot;&#x6211;&#x6765;&#x81EA;flutter&quot;},
 creationParamsCodec: const StandardMessageCodec());

Container(
// width: 80,
height: 80,
child: androidView,
)  ,
</code></pre>
<h1 id="flutter&#x7B2C;&#x4E09;&#x65B9;&#x5E93;"><a name="flutter&#x7B2C;&#x4E09;&#x65B9;&#x5E93;" class="anchor-navigation-ex-anchor" href="#flutter&#x7B2C;&#x4E09;&#x65B9;&#x5E93;"><i class="fa fa-link" aria-hidden="true"></i></a>2. flutter&#x7B2C;&#x4E09;&#x65B9;&#x5E93;</h1>
<h2 id="packageinfo-&#x83B7;&#x53D6;&#x7248;&#x672C;&#x53F7;&#x7B49;"><a name="packageinfo-&#x83B7;&#x53D6;&#x7248;&#x672C;&#x53F7;&#x7B49;" class="anchor-navigation-ex-anchor" href="#packageinfo-&#x83B7;&#x53D6;&#x7248;&#x672C;&#x53F7;&#x7B49;"><i class="fa fa-link" aria-hidden="true"></i></a>2.1. package_info &#x83B7;&#x53D6;&#x7248;&#x672C;&#x53F7;&#x7B49;</h2>
<p>&#x7248;&#x672C;&#x53F7;&#x5728; pubspec.yaml version &#x4E2D;&#x914D;&#x7F6E;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/package_info
PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
  String appName = packageInfo.appName;
  String packageName = packageInfo.packageName;
  String version = packageInfo.version;
  String buildNumber = packageInfo.buildNumber;
});
</code></pre>
<h2 id="urllauncher"><a name="urllauncher" class="anchor-navigation-ex-anchor" href="#urllauncher"><i class="fa fa-link" aria-hidden="true"></i></a>2.2. url_launcher</h2>
<p>&#x901A;&#x8FC7; url &#x6253;&#x5F00;&#x7B2C;&#x4E09;&#x65B9;&#x5E94;&#x7528; &#xFF0C;&#x4F8B;&#x5982;&#x7F51;&#x5740;&#x6253;&#x5F00;&#x6D4F;&#x89C8;&#x5668; &#xFF0C; &#x62E8;&#x6253;&#x7535;&#x8BDD;&#xFF0C;&#x8C03;&#x7528;&#x7B2C;&#x4E09;&#x65B9;APP&#x7B49;&#x3002;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/url_launcher/install
_launchURL() async {
const url = &apos;tel:13457980678&apos;;  // &#x5524;&#x8D77;&#x7535;&#x8BDD;&#x754C;&#x9762;
// const url = &apos;weixin://&apos;; &#x5524;&#x8D77;&#x5FAE;&#x4FE1;
//const url = &apos;http://typhoon.zjwater.gov.cn/wap.htm&apos;; // &#x6253;&#x5F00;&#x6D4F;&#x89C8;&#x5668;
if (await canLaunch(url)) {
  await launch(url);
}
}
</code></pre>
<h2 id="flutterbloc"><a name="flutterbloc" class="anchor-navigation-ex-anchor" href="#flutterbloc"><i class="fa fa-link" aria-hidden="true"></i></a>2.3. flutter_bloc</h2>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/flutter_bloc

// Bloc
&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x7EC4;&#x4EF6; (Business Logic Component) &#x3002;
Bloc &#x5C06;  Event &#x4E8B;&#x4EF6;&#x8F6C;&#x6362;&#x4E3A; States &#x72B6;&#x6001;.
 &#x6BCF;&#x4E2A; Bloc &#x90FD;&#x6709;&#x4E00;&#x4E2A; add &#x65B9;&#x6CD5;&#xFF0C;&#x7528;&#x6765;&#x6DFB;&#x52A0;&#x65B0;&#x7684; Event &#x5230; mapEventToState &#x4E2D;&#xFF1B;

// BlocBuilder
extends StatefulWidget ...
&#x6784;&#x9020;&#x5668;&#xFF0C;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x6784;&#x5EFA; Widget &#x3002;

// BlocProvider
extends Widget ...
BlocProvider &#x4E3A; Bloc &#x7684;&#x4F9B;&#x5E94;&#x8005;&#xFF1B;

// MultiBlocProvider
extends Widget ...
&#x662F;&#x4E00;&#x4E2A;&#x7528;&#x4E8E;&#x5C06;&#x591A;&#x4E2A;BlocProvider&#x5408;&#x5E76;&#x4E3A;&#x4E00;&#x4E2A;BlocProvider&#x7684;&#x7EC4;&#x4EF6;&#x3002;

// BlocListener
t extends Widget ...
&#x7528;&#x4E8E;&#x76D1;&#x542C;&#x72B6;&#x6001;&#x53D8;&#x66F4;&#xFF0C;&#x53EF;&#x5728;&#x6B64;&#x505A;&#x51FA;&#x76F8;&#x5E94;&#x7684;&#x4E1A;&#x52A1;&#x5904;&#x7406;&#xFF1B;
</code></pre>
<h2 id="sharedpreferences"><a name="sharedpreferences" class="anchor-navigation-ex-anchor" href="#sharedpreferences"><i class="fa fa-link" aria-hidden="true"></i></a>2.4. shared_preferences</h2>
<p>key-value &#x5B58;&#x50A8;&#x63D2;&#x4EF6;&#xFF0C; &#x8DDF;android SharedPreferences &#x7684;&#x7C7B;&#x4F3C;&#x3002;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/shared_preferences

SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString(KEY_CITY_MODELS, encodeStr);  // &#x4FDD;&#x5B58;
var parseValue = prefs.getString(KEY_CITY_MODELS); // &#x83B7;&#x53D6;
prefs.remove(key);
prefs.clear();
</code></pre>
<h2 id="dio"><a name="dio" class="anchor-navigation-ex-anchor" href="#dio"><i class="fa fa-link" aria-hidden="true"></i></a>2.5. dio</h2>
<p>http &#x7F51;&#x7EDC;&#x8BBF;&#x95EE;&#x6846;&#x67B6;&#x3002;
Dart Http&#x8BF7;&#x6C42;&#x5E93;&#xFF0C;&#x652F;&#x6301;Restful API&#x3001;FormData&#x3001;&#x62E6;&#x622A;&#x5668;&#x3001;&#x8BF7;&#x6C42;&#x53D6;&#x6D88;&#x3001;Cookie&#x7BA1;&#x7406;&#x3001;&#x6587;&#x4EF6;&#x4E0A;&#x4F20;/&#x4E0B;&#x8F7D;&#x3001;&#x8D85;&#x65F6;&#x3002;</p>
<pre><code class="lang-text">int timeout = 15 *1000 ;
BaseOptions options = BaseOptions( baseUrl: &quot;https://www.baidu.com/&quot;,
    connectTimeout:timeout ,
    receiveTimeout:timeout ,
    sendTimeout:timeout );
Dio dia = Dio(options) ;

Interceptor dInter = InterceptorsWrapper(
    onRequest: (RequestOptions options) {
      return options; // &#x62E6;&#x622A;&#x8BF7;&#x6C42;
    },
    onResponse: (Response response) {
      return response;  // &#x62E6;&#x622A;&#x54CD;&#x5E94;
    },
    onError: (DioError error) { // &#x62E6;&#x622A;&#x5F02;&#x5E38;
      print(&quot;&#x62E6;&#x622A;&#x4E86;&#x9519;&#x8BEF;&quot;);
      return error;
    }
);
dia.interceptors.add( dInter); // &#x6DFB;&#x52A0;&#x62E6;&#x622A;&#x5668;

String url=&quot;https://www.baidu.com/&quot; ;
Map&lt;String, dynamic&gt;  param= Map() ;
Response response = await dia.get(url, queryParameters: param);  //  get &#x8BF7;&#x6C42;
var result =  response.data ;
print(&quot;&#x8BF7;&#x6C42;&#x7ED3;&#x679C;=&quot;+ result);
</code></pre>
<h2 id="eventbus"><a name="eventbus" class="anchor-navigation-ex-anchor" href="#eventbus"><i class="fa fa-link" aria-hidden="true"></i></a>2.6. event_bus</h2>
<p>&#x6D88;&#x606F;&#x4F20;&#x9012;&#x6846;&#x67B6;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/event_bus
https://github.com/marcojakob/dart-event-bus

EventBus eventBus = EventBus();
eventBus.fire(&quot;helloflutter&quot;); // &#x53D1;&#x9001;
StreamSubscription streamSubscription =eventBus.on&lt;String&gt;().listen((event){
  // &#x63A5;&#x6536;
});
streamSubscription.cancel() ; // &#x53D6;&#x6D88;&#x76D1;&#x542C;
streamSubscription.pause() ;//
streamSubscription.resume() ;//
</code></pre>
<h2 id="flutterscreenutil"><a name="flutterscreenutil" class="anchor-navigation-ex-anchor" href="#flutterscreenutil"><i class="fa fa-link" aria-hidden="true"></i></a>2.7. flutter_screenutil</h2>
<p>flutter &#x5C4F;&#x5E55;&#x9002;&#x914D;&#x65B9;&#x6848;&#xFF0C;&#x8BA9;&#x4F60;&#x7684;UI&#x5728;&#x4E0D;&#x540C;&#x5C3A;&#x5BF8;&#x7684;&#x5C4F;&#x5E55;&#x4E0A;&#x90FD;&#x80FD;&#x663E;&#x793A;&#x5408;&#x7406;&#x7684;&#x5E03;&#x5C40;&#x3002;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/flutter_screenutil
https://github.com/OpenFlutter/flutter_ScreenUtil

//&#x8BBE;&#x7F6E;&#x9002;&#x914D;&#x5C3A;&#x5BF8; (&#x586B;&#x5165;&#x8BBE;&#x8BA1;&#x7A3F;&#x4E2D;&#x8BBE;&#x5907;&#x7684;&#x5C4F;&#x5E55;&#x5C3A;&#x5BF8;) &#x6B64;&#x5904;&#x5047;&#x5982;&#x8BBE;&#x8BA1;&#x7A3F;&#x662F;&#x6309;iPhone6&#x7684;&#x5C3A;&#x5BF8;&#x8BBE;&#x8BA1;&#x7684;(iPhone6 750*1334)
// &#x8BBE;&#x7F6E;&#x5B57;&#x4F53;&#x5927;&#x5C0F;&#x662F;&#x5426;&#x6839;&#x636E;&#x7CFB;&#x7EDF;&#x7684;&#x201C;&#x5B57;&#x4F53;&#x5927;&#x5C0F;&#x201D;&#x8F85;&#x52A9;&#x9009;&#x9879;&#x6765;&#x8FDB;&#x884C;&#x7F29;&#x653E;
// ScreenUtil.init(context);  //&#x9ED8;&#x8BA4; width : 1080px , height:1920px , allowFontScaling:false
ScreenUtil.init(context,designSize: Size(750, 1334), allowFontScaling: false);
// var width =  1.wp ;
var width =  1.sw ; // screen height
var width2 =  0.2.sw ; // screen height &#x5C4F;&#x5E55;&#x5BBD;&#x5EA6;&#x7684;0.2&#x500D;

ScreenUtil().pixelRatio   ;     //&#x8BBE;&#x5907;&#x7684;&#x50CF;&#x7D20;&#x5BC6;&#x5EA6;
ScreenUtil().screenWidth  ; // (sdk&gt;=2.6 : 1.sw)   //&#x8BBE;&#x5907;&#x5BBD;&#x5EA6;
ScreenUtil().screenHeight ; //(sdk&gt;=2.6 : 1.sh)   //&#x8BBE;&#x5907;&#x9AD8;&#x5EA6;
ScreenUtil().bottomBarHeight ; //&#x5E95;&#x90E8;&#x5B89;&#x5168;&#x533A;&#x8DDD;&#x79BB;&#xFF0C;&#x9002;&#x7528;&#x4E8E;&#x5168;&#x9762;&#x5C4F;&#x4E0B;&#x9762;&#x6709;&#x6309;&#x952E;&#x7684;
ScreenUtil().statusBarHeight;  //&#x72B6;&#x6001;&#x680F;&#x9AD8;&#x5EA6; &#x5218;&#x6D77;&#x5C4F;&#x4F1A;&#x66F4;&#x9AD8;  &#x5355;&#x4F4D;dp
ScreenUtil().textScaleFactor; //&#x7CFB;&#x7EDF;&#x5B57;&#x4F53;&#x7F29;&#x653E;&#x6BD4;&#x4F8B;
ScreenUtil().scaleWidth ; // &#x5B9E;&#x9645;&#x5BBD;&#x5EA6;&#x7684;dp&#x4E0E;&#x8BBE;&#x8BA1;&#x7A3F;px&#x7684;&#x6BD4;&#x4F8B;
ScreenUtil().scaleHeight; // &#x5B9E;&#x9645;&#x9AD8;&#x5EA6;&#x7684;dp&#x4E0E;&#x8BBE;&#x8BA1;&#x7A3F;px&#x7684;&#x6BD4;&#x4F8B;
</code></pre>
<h2 id="modalbottomsheet"><a name="modalbottomsheet" class="anchor-navigation-ex-anchor" href="#modalbottomsheet"><i class="fa fa-link" aria-hidden="true"></i></a>2.8. modal_bottom_sheet</h2>
<p>&#x5E95;&#x90E8;&#x5F39;&#x7A97;&#x63A7;&#x4EF6;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/modal_bottom_sheet
https://github.com/jamesblasco/modal_bottom_sheet
&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x7528;&#x7CFB;&#x7EDF;&#x63A7;&#x4EF6;&#xFF0C;&#x6CA1;&#x5FC5;&#x8981;&#x7528;&#x8FD9;&#x4E2A;&#x3002;
</code></pre>
<h2 id="pathdrawing"><a name="pathdrawing" class="anchor-navigation-ex-anchor" href="#pathdrawing"><i class="fa fa-link" aria-hidden="true"></i></a>2.9. path_drawing</h2>
<p>&#x7ED8;&#x5236;&#x865A;&#x7EBF;&#x7684;&#x5DE5;&#x5177;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/path_drawing
Path _path = Path();
Canvas canvas ;
Paint _paint = Paint();
canvas.drawPath(
    dashPath(_path, dashArray: CircularIntervalList&lt;double&gt;([10, 5])), // &#x6BCF;&#x4E2A;&#x7EBF;&#x6BB5;&#x957F;&#x5EA6;&#x3001;&#x95F4;&#x9694;&#x957F;&#x5EA6;
    _paint);
</code></pre>
<h2 id="toast"><a name="toast" class="anchor-navigation-ex-anchor" href="#toast"><i class="fa fa-link" aria-hidden="true"></i></a>2.10. toast</h2>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/toast
Toast.show(&quot;Toast plugin app&quot;, context, duration: Toast.LENGTH_SHORT, gravity:  Toast.BOTTOM);
Toast.show(msg, context, duration: duration,
    backgroundColor: backgroundColor,
    textColor: textColor,
    backgroundRadius: backgroundRadius,
    border: border);
</code></pre>
<h2 id="fluttertts"><a name="fluttertts" class="anchor-navigation-ex-anchor" href="#fluttertts"><i class="fa fa-link" aria-hidden="true"></i></a>2.11. flutter_tts</h2>
<p>&#x8BED;&#x97F3;&#x64AD;&#x62A5;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/flutter_tts
</code></pre>
<h2 id="otaupdate"><a name="otaupdate" class="anchor-navigation-ex-anchor" href="#otaupdate"><i class="fa fa-link" aria-hidden="true"></i></a>2.12. ota_update</h2>
<p>&#x5347;&#x7EA7;&#x3001; &#x4E0B;&#x8F7D;apk</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/ota_update
</code></pre>
<h2 id="cupertinoicons"><a name="cupertinoicons" class="anchor-navigation-ex-anchor" href="#cupertinoicons"><i class="fa fa-link" aria-hidden="true"></i></a>2.13. cupertino_icons</h2>
<p>&#x4E00;&#x4E2A;icon&#x56FE;&#x6807;&#x5E93;&#xFF0C;&#x5177;&#x4F53;&#x600E;&#x4E48;&#x7528; &#x4E0D;&#x77E5;&#x9053;&#x3002;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/cupertino_icons
</code></pre>
<h2 id="equatable"><a name="equatable" class="anchor-navigation-ex-anchor" href="#equatable"><i class="fa fa-link" aria-hidden="true"></i></a>2.14. equatable</h2>
<p>&#x7528;&#x6765;&#x7B80;&#x5316; &#x5BF9;&#x8C61;&#x6BD4;&#x8F83;&#x7684;&#x4E00;&#x4E2A;&#x5E93;&#x3002; &#x8FD9;&#x4E2A;&#x5E93;&#x5185;&#x90E8;&#x505A;&#x4E86;&#x4E00;&#x4E9B;&#x5904;&#x7406;&#xFF0C;&#x8BA9;&#x6211;&#x4EEC;&#x7B80;&#x5355;&#x5730;&#x7528; == &#x5373;&#x53EF;&#x5224;&#x65AD;&#x5BF9;&#x8C61;&#x662F;&#x5426;&#x76F8;&#x7B49;&#xFF0C;&#x4E0D;&#x7528;&#x91CD;&#x5199;hashcode&#x3002;</p>
<pre><code class="lang-text">https://pub.flutter-io.cn/packages/equatable
</code></pre>
<h1 id="dart-&#x8BED;&#x6CD5;"><a name="dart-&#x8BED;&#x6CD5;" class="anchor-navigation-ex-anchor" href="#dart-&#x8BED;&#x6CD5;"><i class="fa fa-link" aria-hidden="true"></i></a>3. dart &#x8BED;&#x6CD5;</h1>
<pre><code class="lang-text">dart &#x6587;&#x4EF6;&#x540D;&#x548C;&#x7C7B;&#x540D; &#x53EF;&#x4EE5;&#x4E0D;&#x4E00;&#x6837;&#x3002;&#x8FD9;&#x70B9;&#x8DDF;Java&#x4E0D;&#x4E00;&#x6837;&#x3002;
&#x5728;&#x53D8;&#x91CF;&#x4E2D;&#x53EF;&#x4EE5;&#x653E;&#x7F6E;&#x7684;&#x6240;&#x6709;&#x4E1C;&#x897F;&#x90FD;&#x662F;&#x5BF9;&#x8C61;&#xFF0C;&#x800C;&#x6BCF;&#x4E2A;&#x5BF9;&#x8C61;&#x90FD;&#x662F;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x3002;&#x65E0;&#x8BBA;&#x6570;&#x5B57;&#x3001;&#x51FD;&#x6570;&#x548C;null&#x90FD;&#x662F;&#x5BF9;&#x8C61;&#x3002;
&#x5982;&#x679C;&#x8981;&#x660E;&#x786E;&#x8BF4;&#x660E;&#x4E0D;&#x9700;&#x8981;&#x4EFB;&#x4F55;&#x7C7B;&#x578B;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;[&#x7279;&#x6B8A;&#x7C7B;&#x578B;dynamic]&#x3002;
</code></pre>
<h2 id="&#x80D6;&#x7BAD;&#x5934;&#x8BED;&#x6CD5;"><a name="&#x80D6;&#x7BAD;&#x5934;&#x8BED;&#x6CD5;" class="anchor-navigation-ex-anchor" href="#&#x80D6;&#x7BAD;&#x5934;&#x8BED;&#x6CD5;"><i class="fa fa-link" aria-hidden="true"></i></a>3.1. &#x80D6;&#x7BAD;&#x5934;&#x8BED;&#x6CD5;</h2>
<pre><code class="lang-text"> = &gt;expr &#x8BED;&#x6CD5;&#x662F;{return expr;}&#x7684;&#x7B80;&#x5199;&#x5199;&#x6CD5;&#x3002;&#x201C;=&gt;&#x201D;&#x7B26;&#x53F7;&#x6709;&#x65F6;&#x88AB;&#x79F0;&#x4E3A;&#x80D6;&#x7BAD;&#x5934;&#x8BED;&#x6CD5;&#x3002;
 =&gt; expr &#x7B49;&#x540C;&#x4E8E;{ return expr; }
</code></pre>
<h2 id="&#x53EF;&#x89C1;&#x6027;"><a name="&#x53EF;&#x89C1;&#x6027;" class="anchor-navigation-ex-anchor" href="#&#x53EF;&#x89C1;&#x6027;"><i class="fa fa-link" aria-hidden="true"></i></a>3.2. &#x53EF;&#x89C1;&#x6027;</h2>
<pre><code class="lang-text">// &#x53EF;&#x89C1;&#x6027; &#xFF0C;public private &#x8DDF;Java&#x4E0D;&#x4E00;&#x6837;
Dart&#x6CA1;&#x6709;&#x516C;&#x5F00;&#x3001;&#x4FDD;&#x62A4;&#x548C;&#x79C1;&#x6709;&#x7684;&#x5173;&#x952E;&#x5B57;&#x3002;
&#x5982;&#x679C;&#x6807;&#x8BC6;&#x7B26;&#x4EE5;&#x4E0B;&#x5212;&#x7EBF;(_)&#x5F00;&#x5934;&#xFF0C;&#x5219;&#x8BE5;&#x6807;&#x8BC6;&#x7B26;&#x5BF9;&#x5176;&#x5E93;&#x662F;&#x79C1;&#x6709;&#x7684;&#x3002;
</code></pre>
<h2 id="final-&#x3001;const"><a name="final-&#x3001;const" class="anchor-navigation-ex-anchor" href="#final-&#x3001;const"><i class="fa fa-link" aria-hidden="true"></i></a>3.3. final &#x3001;const</h2>
<pre><code class="lang-text">final&#x548C;const&#x533A;&#x522B; &#xFF1A;
const&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5176;&#x4ED6;const&#x5E38;&#x91CF;&#x7684;&#x503C;&#x6765;&#x521D;&#x59CB;&#x5316;&#x5176;&#x503C;&#x3002;
final dt = DateTime.now();//&#x6B63;&#x786E;&#xFF0C;&#x8FD0;&#x884C;&#x65F6;&#x6709;&#x786E;&#x5B9A;&#x7684;&#x503C;
const dt = const DateTime.now();//&#x9519;&#x8BEF;&#xFF0C;&#x9700;&#x8981;&#x7F16;&#x8BD1;&#x65F6;&#x6709;&#x786E;&#x5B9A;&#x7684;&#x503C;
// &#x521D;&#x59CB;&#x5316;&#x540E;&#x4E0D;&#x80FD;&#x518D;&#x8D4B;&#x503C;
final a = &apos;aaa&apos;;
a =  &apos;abc&apos;; //&#x9519;&#x8BEF;
const b = &apos;bbb&apos;;
b =  &apos;abc&apos;; //&#x9519;&#x8BEF;
//&#x4E0D;&#x80FD;&#x548C;var&#x540C;&#x65F6;&#x4F7F;&#x7528;
final var d = &apos;abc&apos;;//&#x9519;&#x8BEF;
const var e = &apos;abc&apos;;//&#x9519;&#x8BEF;
</code></pre>
<h2 id="&#x6570;&#x5B57;&#x7C7B;&#x578B;"><a name="&#x6570;&#x5B57;&#x7C7B;&#x578B;" class="anchor-navigation-ex-anchor" href="#&#x6570;&#x5B57;&#x7C7B;&#x578B;"><i class="fa fa-link" aria-hidden="true"></i></a>3.4. &#x6570;&#x5B57;&#x7C7B;&#x578B;</h2>
<pre><code class="lang-text">// &#x6570;&#x5B57;&#x7C7B;&#x578B; &#x53EA;&#x6709; int &#x548C; double
var one = int.parse(&apos;1&apos;);
var msg = 3.156.toString() ;
var msg2 = 3.156.toStringAsFixed(2);
</code></pre>
<h2 id="&#x53D8;&#x91CF;-&#x7684;&#x521D;&#x59CB;&#x503C;"><a name="&#x53D8;&#x91CF;-&#x7684;&#x521D;&#x59CB;&#x503C;" class="anchor-navigation-ex-anchor" href="#&#x53D8;&#x91CF;-&#x7684;&#x521D;&#x59CB;&#x503C;"><i class="fa fa-link" aria-hidden="true"></i></a>3.5. &#x53D8;&#x91CF; &#x7684;&#x521D;&#x59CB;&#x503C;</h2>
<pre><code class="lang-text">&#x672A;&#x521D;&#x59CB;&#x5316;&#x7684;&#x53D8;&#x91CF;&#x7684;&#x521D;&#x59CB;&#x503C;&#x4E3A;null&#x3002;
&#x751A;&#x81F3;&#x5177;&#x6709;&#x6570;&#x5B57;&#x7C7B;&#x578B;&#x7684;&#x53D8;&#x91CF;&#x6700;&#x521D;&#x4E5F;&#x662F;null&#xFF0C;&#x56E0;&#x4E3A;&#x6570;&#x5B57;&#xFF0C;&#x5C31;&#x50CF;dart&#x4E2D;&#x7684;&#x5176;&#x4ED6;&#x4E1C;&#x897F;&#x4E00;&#x6837;&#x4E5F;&#x662F;&#x5BF9;&#x8C61;&#x3002;

&#x5728;Dart2&#x4E2D;new&#x5173;&#x952E;&#x5B57;&#x662F;&#x53EF;&#x9009;&#x7684;&#x3002; &#x5373; new &#x5173;&#x952E;&#x5B57;&#x53EF;&#x5199;&#x53EF;&#x4E0D;&#x5199;&#x3002;
Dart&#x662F;&#x4E00;&#x79CD;&#x771F;&#x6B63;&#x7684;&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x8BED;&#x8A00;&#xFF0C;&#x6240;&#x4EE5;&#x5373;&#x4F7F;&#x51FD;&#x6570;&#x4E5F;&#x662F;&#x5BF9;&#x8C61;&#x3002;

b ??= value;   // &#x4EC5;&#x4EC5;&#x5728;b&#x4E3A;&#x7A7A;&#x7684;&#x60C5;&#x51B5;&#x4E0B;b&#x88AB;&#x8D4B;&#x503C;value &#xFF0C;&#x5426;&#x5219;b&#x7684;&#x503C;&#x4E0D;&#x53D8;
print(person ?.name)  //  person &#x4E3A;&#x7A7A; &#x5C31;&#x76F4;&#x63A5;&#x8FD4;&#x56DE;null &#xFF0C;&#x4E0D;&#x4E3A;&#x7A7A; &#x5C31;&#x8FD4;&#x56DE; name&#x7684;&#x503C;
</code></pre>
<h2 id="&#x7C7B;&#x578B;-&#x5224;&#x65AD;-&#x3001;&#x8F6C;&#x6362;"><a name="&#x7C7B;&#x578B;-&#x5224;&#x65AD;-&#x3001;&#x8F6C;&#x6362;" class="anchor-navigation-ex-anchor" href="#&#x7C7B;&#x578B;-&#x5224;&#x65AD;-&#x3001;&#x8F6C;&#x6362;"><i class="fa fa-link" aria-hidden="true"></i></a>3.6. &#x7C7B;&#x578B; &#x5224;&#x65AD; &#x3001;&#x8F6C;&#x6362;</h2>
<pre><code class="lang-text">if (emp is Person)  // &#x7C7B;&#x578B;&#x5224;&#x65AD; is
(emp as Person) // &#x7C7B;&#x578B;&#x8F6C;&#x6362;  as
</code></pre>
<h2 id="&#x5B57;&#x7B26;&#x4E32;"><a name="&#x5B57;&#x7B26;&#x4E32;" class="anchor-navigation-ex-anchor" href="#&#x5B57;&#x7B26;&#x4E32;"><i class="fa fa-link" aria-hidden="true"></i></a>3.7. &#x5B57;&#x7B26;&#x4E32;</h2>
<pre><code class="lang-text">//  &#x7528;r&#x524D;&#x7F00;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x539F;&#x59CB;&#x5B57;&#x7B26;&#x4E32; (&#x5373; &#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#x6CA1;&#x6709;&#x88AB;&#x8F6C;&#x4E49;)
var msg1 = r&apos;In a raw string, not even \n gets special treatment.&apos;;

// &#x591A;&#x884C;&#x5B57;&#x7B26;&#x4E32; &#xFF0C;&#x7528; + &#x8FDE;&#x63A5; &#xFF0C;&#x6216;&#x8005;&#x662F; &#x5E26;&#x6709;&#x5355;&#x5F15;&#x53F7;&#x6216;&#x53CC;&#x5F15;&#x53F7;&#x7684;&#x4E09;&#x91CD;&#x5F15;&#x53F7;
var msg1 =
  &apos;&apos;&apos;1111
  222222
  33333
  &apos;&apos;&apos;;

&#x5B57;&#x7B26;&#x4E32;&#x7528; &#x7B49;&#x53F7; == &#x6765;&#x5224;&#x65AD;&#x5BF9;&#x8C61;&#x662F;&#x5426;&#x76F8;&#x7B49;&#xFF0C;&#x8DDF;Java&#x4E0D;&#x592A;&#x4E00;&#x6837;&#x3002;
var msg1 =&quot;abc1&quot; ;
var msg2 =&quot;abc&quot;+&quot;1&quot; ;
print(msg1==msg2) ;  // true
</code></pre>
<h2 id="&#x51FD;&#x6570;"><a name="&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>3.8. &#x51FD;&#x6570;</h2>
<pre><code class="lang-text">// &#x547D;&#x540D;&#x51FD;&#x6570; &#xFF0C;&#x53EF;&#x4EE5;&#x5E26;&#x6709;&#x9ED8;&#x8BA4;&#x503C;
void enableFlags( { int age =18, String myName } ) {
  print( &quot;age=$age ,name=$myName&quot;) ; // age=20 ,name=aivin
}
 // age &#x548C; myName &#x5728;&#x51FD;&#x6570;&#x4E2D;&#x5DF2;&#x7ECF;&#x5B9A;&#x4E49;&#x4E86;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x76F4;&#x63A5;&#x521D;&#x59CB;&#x5316;&#xFF0C;&#x6B64;&#x5904; age &#x4E0D;&#x80FD;&#x5199;&#x6210;&#x5176;&#x4ED6; age1&#x7B49;
 enableFlags( age: 20, myName: &quot;aivin&quot;);

// &#x4F4D;&#x7F6E;&#x53C2;&#x6570;
void  say(String from, String msg, [ int time]) {
  var result = &apos;$from says $msg $time&apos;; // aivin says &#x73B0;&#x5728;&#x65F6;&#x95F4;&#x662F;: null
  print(result) ;
}
say(&apos;aivin&apos; ,&apos;&#x73B0;&#x5728;&#x65F6;&#x95F4;&#x662F;:&apos;   ) ;

// &#x7EA7;&#x8054;&#x64CD;&#x4F5C;&#x7B26; &#xFF0C;&#x8DDF;Java&#x7684;&#x94FE;&#x5F0F;&#x8C03;&#x7528;&#x5DEE;&#x4E0D;&#x591A;
  Address address =   Address();
  address  ..street = &apos;&#x5317;&#x4EAC;&#x5E02;&apos;
    ..number = &apos;12&apos;
    ..name = &apos;&#x897F;&#x57CE;&#x533A;&apos;

 &#x6240;&#x6709;&#x51FD;&#x6570;&#x90FD;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x503C;&#x3002;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6307;&#x5B9A;&#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x5219;&#x8BED;&#x53E5;&#x8FD4;&#x56DE;null;&#x9690;&#x5F0F;&#x9644;&#x52A0;&#x5230;&#x51FD;&#x6570;&#x4F53;&#x3002;

//  &#x533F;&#x540D;&#x51FD;&#x6570;
Function showMsg = (int x, String y) {
  print(&quot;$x &quot;);
};
</code></pre>
<h2 id="&#x5217;&#x8868;&#x3001;&#x6570;&#x7EC4;"><a name="&#x5217;&#x8868;&#x3001;&#x6570;&#x7EC4;" class="anchor-navigation-ex-anchor" href="#&#x5217;&#x8868;&#x3001;&#x6570;&#x7EC4;"><i class="fa fa-link" aria-hidden="true"></i></a>3.9. &#x5217;&#x8868;&#x3001;&#x6570;&#x7EC4;</h2>
<pre><code class="lang-text"> var list = [1, 2, 3];  // &#x53EF;&#x53D8;&#x5217;&#x8868;&#x3001;&#x6570;&#x7EC4;
 var list2 = const [1, 2, 3]; // &#x5E38;&#x91CF;&#x5217;&#x8868;
</code></pre>
<h2 id="&#x6784;&#x9020;&#x51FD;&#x6570;"><a name="&#x6784;&#x9020;&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x6784;&#x9020;&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>3.10. &#x6784;&#x9020;&#x51FD;&#x6570;</h2>
<pre><code class="lang-text">// &#x6784;&#x9020;&#x51FD;&#x6570;
class Point {
  num x, y;

  Point(num x, num y) {
    this.x = x;
    this.y = y;
  }
}

&#x53EF;&#x4EE5;&#x7B80;&#x5199;&#x6210; ---&gt; 
class Point {
  num x, y;

  Point(this.x, this.y); // &#x8BED;&#x6CD5;&#x7CD6;&#xFF0C;&#x6784;&#x9020;&#x51FD;&#x6570;&#x7684;&#x7B80;&#x5199;
}

---------------------------------------------------
class Point {
  num x, y;
  // &#x7C7B;&#x540D;&#x6784;&#x9020;&#x51FD;&#x6570;
  Point(this.x, this.y);
  // &#x547D;&#x540D;&#x6784;&#x9020;&#x51FD;&#x6570;
  Point.order(this.x,this.y);
  // &#x91CD;&#x5B9A;&#x5411;&#x6784;&#x9020;&#x51FD;&#x6570;&#xFF0C; origin&#x6784;&#x9020;&#x51FD;&#x6570;&#x5C06;&#x5916;&#x754C;&#x7684;&#x4F20;&#x503C;&#xFF0C;&#x6307;&#x5411;&#x7ED9;&#x4E86;order&#x6784;&#x9020;&#x51FD;&#x6570;&#x3002;
  Point.origin(num a,num b):this.order(a,b);  
}

---------------------------------------------------
class Person {
  String firstName;

  Person.fromJson(Map data) {
    print(&apos;in Person&apos;);
  }
}

class Employee extends Person {
  // &#x8C03;&#x7528;&#x7236;&#x7C7B;&#x6784;&#x9020;&#x51FD;&#x6570;&#xFF0C; &#x8BED;&#x6CD5;&#x4E0E;Java&#x4E0D;&#x4E00;&#x6837;&#x3002;
  // &#x5148;&#x6253;&#x5370;  in Person &#xFF0C; &#x540E;&#x6253;&#x5370;  in Employee
  Employee.fromJson(Map data) : super.fromJson(data) {
    print(&apos;in Employee&apos;);
  }
}

main() {
  var emp = new Employee.fromJson({});
}
</code></pre>
<h2 id="&#x95ED;&#x5305;"><a name="&#x95ED;&#x5305;" class="anchor-navigation-ex-anchor" href="#&#x95ED;&#x5305;"><i class="fa fa-link" aria-hidden="true"></i></a>3.11. &#x95ED;&#x5305;</h2>
<pre><code class="lang-text">//  java &#x95ED;&#x5305; &#xFF0C;&#x7528;&#x63A5;&#x53E3; &#x548C;&#x533F;&#x540D;&#x51FD;&#x6570; &#x5B9E;&#x73B0;&#x3002;-- &#x6240;&#x8C13;&#x95ED;&#x5305;&#x4ECE;&#x8868;&#x9762;&#x770B;&#x5C31;&#x662F;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A; &#x51FD;&#x6570;
    interface  AaddFunc{
        int addBy(int value);
    }

    public static  AaddFunc createNewFunction(final int value){
        return  new AaddFunc() {
            @Override
            public int addBy(int addBy) {
                return value + addBy;
            }
        }  ;
    }

AaddFunc func =  createNewFunction(1) ;
 int result =func.addBy(10) ;

// dart &#x95ED;&#x5305;
Function makeAdder( int addBy) {
  return (int value)  {
    return addBy + value;
  } ;
}

var func1 = makeAdder(10);
var result =func1(1); //11
</code></pre>
<h2 id="&#x4E09;&#x76EE;&#x8FD0;&#x7B97;&#x7B26;"><a name="&#x4E09;&#x76EE;&#x8FD0;&#x7B97;&#x7B26;" class="anchor-navigation-ex-anchor" href="#&#x4E09;&#x76EE;&#x8FD0;&#x7B97;&#x7B26;"><i class="fa fa-link" aria-hidden="true"></i></a>3.12. &#x4E09;&#x76EE;&#x8FD0;&#x7B97;&#x7B26;</h2>
<pre><code class="lang-text">dart &#x652F;&#x6301;&#x4E09;&#x76EE;&#x8FD0;&#x7B97;&#x7B26;&#x3002; &#x53C2;&#x8003;Java
</code></pre>
<h2 id="mixin--&#x7279;&#x6027;"><a name="mixin--&#x7279;&#x6027;" class="anchor-navigation-ex-anchor" href="#mixin--&#x7279;&#x6027;"><i class="fa fa-link" aria-hidden="true"></i></a>3.13. mixin  &#x7279;&#x6027;</h2>
<pre><code class="lang-text">mixin  &#x5E76;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x5173;&#x952E;&#x5B57;&#xFF0C;&#x53EA;&#x662F;&#x4E00;&#x4E2A;&#x666E;&#x901A;&#x7684;&#x5355;&#x8BCD;&#xFF0C;&#x610F;&#x601D;&#x662F;&#x6DF7;&#x5408;
Dart&#x4E2D;&#xFF0C;&#x6BCF;&#x4E2A;&#x7C7B;&#xFF08;&#x9664;&#x4E86;Object&#x7C7B;&#xFF09;&#x90FD;&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x8D85;&#x7C7B;&#x3002;
&#x4F46;&#x662F;&#x6211;&#x4EEC;&#x6709;&#x65F6;&#x9700;&#x8981;&#x591A;&#x4E2A;&#x7236;&#x7C7B;&#x7684;&#x7279;&#x6027;&#xFF0C;&#x53EF;&#x4EE5;&#x7528; with  &#x6765;&#x5B9E;&#x73B0; minxin &#x7279;&#x6027;&#x3002;
class Walker {
  void walk() {
    print(&quot;I&apos;m walking&quot;);
  }
}
class Fish {
  void swim() {
    print(&quot;I&apos;m swimming&quot;);
  }
}

/**
    Person person = Person() ;
    person.walk() ;
    person.swim() ;
 */
class Person with Walker , Fish  { }
</code></pre>
<h2 id="&#x5F02;&#x6B65;&#x51FD;&#x6570;--async--await"><a name="&#x5F02;&#x6B65;&#x51FD;&#x6570;--async--await" class="anchor-navigation-ex-anchor" href="#&#x5F02;&#x6B65;&#x51FD;&#x6570;--async--await"><i class="fa fa-link" aria-hidden="true"></i></a>3.14. &#x5F02;&#x6B65;&#x51FD;&#x6570;  async  await</h2>
<pre><code class="lang-text">// &#x5F02;&#x6B65;&#x51FD;&#x6570;  async  await
Dart&#x662F;&#x5355;&#x7EBF;&#x7A0B;&#x7684;&#x8BED;&#x8A00;&#xFF0C; &#x5728;Dart1.9&#x4E2D;&#x52A0;&#x5165;&#x4E86;async&#x548C;await&#x5173;&#x952E;&#x5B57;&#xFF0C;&#x6709;&#x4E86;&#x8FD9;&#x4E24;&#x4E2A;&#x5173;&#x952E;&#x5B57;&#xFF0C;
&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x66F4;&#x7B80;&#x6D01;&#x7684;&#x7F16;&#x5199;&#x5F02;&#x6B65;&#x4EE3;&#x7801;&#xFF0C;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x8C03;&#x7528;Future&#x76F8;&#x5173;&#x7684;API&#xFF08;&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x76F8;&#x5BF9;&#x7E41;&#x7410;&#xFF09;&#x3002;
&#x7528;async&#x6807;&#x8BB0;&#xFF0C;&#x8868;&#x793A;&#x51FD;&#x6570;&#x5185;&#x90E8;&#x5305;&#x542B;&#x6709;&#x9700;&#x8981;&#x5EF6;&#x8FDF;&#x6267;&#x884C;&#x7684;&#x4EE3;&#x7801;&#x3002;
&#x6709;await&#x6807;&#x8BB0;&#x7684;&#x8FD0;&#x7B97;&#xFF0C;&#x5176;&#x7ED3;&#x679C;&#x503C;&#x90FD;&#x662F;&#x4E00;&#x4E2A;Future&#x5BF9;&#x8C61; &#xFF08;&#x9A6C;&#x4E0A;&#x8FD4;&#x56DE;&#xFF09;&#x3002;
// &#x4E3E;&#x4E2A;&#x4F8B;&#x5B50; &#x5C31;&#x4F1A;&#x660E;&#x767D;
func(String callType) async {
  print(&apos;$callType =  &#x65B9;&#x6CD5;&#x5185;&#x90E8;  await &#x8BED;&#x53E5;&#x4E4B;&#x524D;  &apos;);
  await print(&apos;$callType  = await &#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;  &apos;);
  print(&apos;$callType =  &#x65B9;&#x6CD5;&#x5185;&#x90E8;  await &#x8BED;&#x53E5;&#x4E4B;&#x540E; &apos;);
}

/*
1 &#x65B9;&#x6CD5; &#x901A;&#x8FC7; awiat &#x8C03;&#x7528; =  &#x65B9;&#x6CD5;&#x5185;&#x90E8;  await &#x8BED;&#x53E5;&#x4E4B;&#x524D;
1 &#x65B9;&#x6CD5; &#x901A;&#x8FC7; awiat &#x8C03;&#x7528;  = await &#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;
1 &#x65B9;&#x6CD5; &#x901A;&#x8FC7; awiat &#x8C03;&#x7528; =  &#x65B9;&#x6CD5;&#x5185;&#x90E8;  await &#x8BED;&#x53E5;&#x4E4B;&#x540E;
1 ---------------------------
2 &#x65B9;&#x6CD5;&#x76F4;&#x63A5;&#x8C03;&#x7528; =  &#x65B9;&#x6CD5;&#x5185;&#x90E8;  await &#x8BED;&#x53E5;&#x4E4B;&#x524D;
2 &#x65B9;&#x6CD5;&#x76F4;&#x63A5;&#x8C03;&#x7528;  = await &#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;
2 ----------------------------
2 &#x65B9;&#x6CD5;&#x76F4;&#x63A5;&#x8C03;&#x7528; =  &#x65B9;&#x6CD5;&#x5185;&#x90E8;  await &#x8BED;&#x53E5;&#x4E4B;&#x540E;
 */
main( ) async {
  // await &#x65B9;&#x5F0F;&#x8C03;&#x7528;&#x5F02;&#x6B65;&#x65B9;&#x6CD5; , &#x5219;&#x4F1A;&#x7B49;&#x5F02;&#x6B65;&#x65B9;&#x6CD5;&#x6267;&#x884C;&#x5B8C;&#x6210;&#x540E;&#x518D;&#x6267;&#x884C;&#x540E;&#x7EED;&#x7684;&#x4EE3;&#x7801;
  await func(&apos;1 &#x65B9;&#x6CD5; &#x901A;&#x8FC7; awiat &#x8C03;&#x7528;&apos;);
  print(&apos;1 ---------------------------&apos;);
  // &#x6CA1;&#x6709;&#x4F7F;&#x7528; await &#x65B9;&#x5F0F;&#x8C03;&#x7528;&#x5F02;&#x6B65;&#x65B9;&#x6CD5;&#xFF0C;&#x5219;&#x5F02;&#x6B65;&#x65B9;&#x6CD5;&#x6267;&#x884C;&#x5230; await &#x5904;&#x540E;&#x7B49;&#x5F85; ( await&#x6240;&#x5728;&#x7684;&#x8BED;&#x53E5;&#x4F1A;&#x8C03;&#x7528;&#xFF0C;&#x662F;&#x5728;&#x7B49;&#x5F85;&#x8FD4;&#x56DE;&#x7ED3;&#x679C;)&#xFF0C;&#x7A0B;&#x5E8F;&#x7EE7;&#x7EED;&#x6267;&#x884C;&#x5F02;&#x6B65;&#x65B9;&#x6CD5;&#x5916;&#x7684;&#x540E;&#x7EED;&#x4EE3;&#x7801;
  func(&apos;2 &#x65B9;&#x6CD5;&#x76F4;&#x63A5;&#x8C03;&#x7528;&apos;);
  print(&apos;2 ----------------------------&apos;);
}
</code></pre>
<h2 id="&#x751F;&#x6210;&#x5668;"><a name="&#x751F;&#x6210;&#x5668;" class="anchor-navigation-ex-anchor" href="#&#x751F;&#x6210;&#x5668;"><i class="fa fa-link" aria-hidden="true"></i></a>3.15. &#x751F;&#x6210;&#x5668;</h2>
<pre><code class="lang-text">// &#x540C;&#x6B65;&#x751F;&#x6210;&#x5668;  Iterable &#x3001; sync* &#x3001;yield
Iterable&lt;int&gt; getSyncGenerator(int n ) sync* {
  int k = n;
  while (k &gt; 0) {
    yield k--;
  }
}

//&#x5F02;&#x6B65;&#x751F;&#x6210;&#x5668;&#xFF1A; Stream &#x3001; async* &#x3001; yield
Stream &lt;int&gt; getAsyncGenerator(int n) async* {
  int k = 0;
  while (k &lt; n) {
    yield k++;
  }
}

void main (){
  var it = getSyncGenerator(5).iterator;
  while (it.moveNext()) {
    print(it.current);
  }

  var stream =   getAsyncGenerator(5);
  // subscription.cancel();
  StreamSubscription subscription = stream.listen(null);
  subscription.onData( (value) {
    print(value);
  });
}
</code></pre>
<h2 id="call-&#x51FD;&#x6570;"><a name="call-&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#call-&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>3.16. call &#x51FD;&#x6570;</h2>
<pre><code class="lang-text">&#x7C7B;&#x7684; &#x7279;&#x6B8A;&#x51FD;&#x6570; call () &#x3002; 
&#x5B9E;&#x73B0;call()&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x8BA9;&#x4F60;&#x7684;Dart&#x7C7B;&#x50CF;&#x51FD;&#x6570;&#x4E00;&#x6837;&#x88AB;&#x8C03;&#x7528;&#x3002; 
&#x4E0D;&#x4E60;&#x60EF;&#x8FD9;&#x6837;&#x3002;&#x6682;&#x4EC5;&#x505A;&#x4E86;&#x89E3;&#x3002;

class Person {
  call(String a, String b ) {
   return  &apos;$a $b  &apos; ;
  }
}

main() {
  var person = new Person();
  var out = person(&quot;Hi&quot;, &quot;aivin&quot; );
  print(&apos;$out&apos;);
}
</code></pre>
<h2 id="&#x591A;&#x8FDB;&#x7A0B;&#x673A;&#x5236;-isolate"><a name="&#x591A;&#x8FDB;&#x7A0B;&#x673A;&#x5236;-isolate" class="anchor-navigation-ex-anchor" href="#&#x591A;&#x8FDB;&#x7A0B;&#x673A;&#x5236;-isolate"><i class="fa fa-link" aria-hidden="true"></i></a>3.17. &#x201C;&#x591A;&#x8FDB;&#x7A0B;&#x201D;&#x673A;&#x5236; Isolate</h2>
<pre><code class="lang-text">// &#x201C;&#x591A;&#x8FDB;&#x7A0B;&#x201D;&#x673A;&#x5236; Isolate
isolate&#x662F;Dart&#x5E73;&#x53F0;&#x5BF9;&#x7EBF;&#x7A0B;&#x7684;&#x5B9E;&#x73B0;&#x65B9;&#x6848;&#xFF0C;&#x4F46;&#x548C;&#x666E;&#x901A;Thread&#x4E0D;&#x540C;&#x7684;&#x662F;&#xFF0C;isolate&#x62E5;&#x6709;&#x72EC;&#x7ACB;&#x7684;&#x5185;&#x5B58;&#xFF0C;isolate&#x7531;&#x7EBF;&#x7A0B;&#x548C;&#x72EC;&#x7ACB;&#x5185;&#x5B58;&#x6784;&#x6210;&#x3002;
&#x7531;&#x4E8E;isolate&#x7EBF;&#x7A0B;&#x4E4B;&#x95F4;&#x7684;&#x5185;&#x5B58;&#x4E0D;&#x5171;&#x4EAB;&#xFF0C;&#x6240;&#x4EE5;isolate&#x7EBF;&#x7A0B;&#x4E4B;&#x95F4;&#x5E76;&#x4E0D;&#x5B58;&#x5728;&#x8D44;&#x6E90;&#x62A2;&#x593A;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x6240;&#x4EE5;&#x4E5F;&#x4E0D;&#x9700;&#x8981;&#x9501;&#x3002;
isolate&#x7EBF;&#x7A0B;&#x4E4B;&#x95F4;&#x7684;&#x901A;&#x4FE1;&#x4E3B;&#x8981;&#x901A;&#x8FC7;port&#x6765;&#x8FDB;&#x884C;&#xFF0C;&#x8FD9;&#x4E2A;port&#x6D88;&#x606F;&#x4F20;&#x9012;&#x7684;&#x8FC7;&#x7A0B;&#x662F;&#x5F02;&#x6B65;&#x7684;&#x3002;
isolate&#x770B;&#x8D77;&#x6765;&#x5176;&#x5B9E;&#x548C;&#x8FDB;&#x7A0B;&#x6BD4;&#x8F83;&#x76F8;&#x4F3C;&#xFF0C;&#x4E4B;&#x524D;&#x8BF7;&#x6559;&#x963F;&#x91CC;&#x67B6;&#x6784;&#x5E08;&#x5B97;&#x5FC3;&#x95EE;&#x9898;&#x65F6;&#xFF0C;
&#x5B97;&#x5FC3;&#x4E5F;&#x8BF4;&#x8FC7;&#x201C;isolate&#x7684;&#x6574;&#x4F53;&#x6A21;&#x578B;&#x6211;&#x81EA;&#x5DF1;&#x7684;&#x7406;&#x89E3;&#x5176;&#x5B9E;&#x66F4;&#x50CF;&#x8FDB;&#x7A0B;&#xFF0C;&#x800C;async&#x3001;await&#x66F4;&#x50CF;&#x662F;&#x7EBF;&#x7A0B;&#x201D;&#x3002;
&#x5982;&#x679C;&#x5BF9;&#x6BD4;&#x4E00;&#x4E0B;isolate&#x548C;&#x8FDB;&#x7A0B;&#x7684;&#x5B9A;&#x4E49;&#xFF0C;&#x4F1A;&#x53D1;&#x73B0;&#x786E;&#x5B9E;isolate&#x5F88;&#x50CF;&#x662F;&#x8FDB;&#x7A0B;&#x3002; &#xFF08;&#x8FD9;&#x6BB5;&#x8BDD;&#x6765;&#x81EA;&#x7F51;&#x7EDC;&#xFF0C;&#x6211;&#x6682;&#x65F6;&#x6CA1;&#x6709;&#x7528;&#x5230;&#x8FC7; Isolate &#xFF09;
</code></pre>
<h2 id="&#x6CE8;&#x89E3;"><a name="&#x6CE8;&#x89E3;" class="anchor-navigation-ex-anchor" href="#&#x6CE8;&#x89E3;"><i class="fa fa-link" aria-hidden="true"></i></a>3.18. &#x6CE8;&#x89E3;</h2>
<pre><code class="lang-text">// immutable
&#x88AB; @immutable &#x6CE8;&#x89E3;&#x6807;&#x660E;&#x7684;&#x7C7B;&#x6216;&#x8005;&#x5B50;&#x7C7B;&#x90FD;&#x5FC5;&#x987B;&#x662F;&#x4E0D;&#x53EF;&#x53D8;&#x7684; .
</code></pre>
<h2 id="&#x968F;&#x673A;&#x6570;"><a name="&#x968F;&#x673A;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x968F;&#x673A;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>3.19. &#x968F;&#x673A;&#x6570;</h2>
<pre><code class="lang-text">// &#x968F;&#x673A;&#x6570;
weatherType = WeatherType.values[Random().nextInt(WeatherType.values.length)];
</code></pre>
<footer class="page-footer"><span class="copyright">( no Copyright&#xFF0C;enjoy youself ! ) all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">The file was updated at :
2022-04-04 10:49:02
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../kotlin/kotlin部分.html" class="navigation navigation-prev " aria-label="Previous page: kotlin部分">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../native/ccpp.html" class="navigation navigation-next " aria-label="Next page: native部分">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"flutter部分","level":"1.16","depth":1,"next":{"title":"native部分","level":"1.17","depth":1,"path":"chinese/native/ccpp.md","ref":"chinese/native/ccpp.md","articles":[{"title":"Linux","level":"1.17.1","depth":2,"path":"chinese/native/Linux.md","ref":"chinese/native/Linux.md","articles":[]},{"title":"cCpp","level":"1.17.2","depth":2,"path":"chinese/native/ccpp.md","ref":"chinese/native/ccpp.md","articles":[]},{"title":"NDK","level":"1.17.3","depth":2,"path":"chinese/native/NDK.md","ref":"chinese/native/NDK.md","articles":[]},{"title":"系统编译剪裁","level":"1.17.4","depth":2,"path":"chinese/native/系统编译剪裁.md","ref":"chinese/native/系统编译剪裁.md","articles":[]},{"title":"音视频","level":"1.17.5","depth":2,"path":"chinese/native/音视频.md","ref":"chinese/native/音视频.md","articles":[]},{"title":"音视频第三方库","level":"1.17.6","depth":2,"path":"chinese/native/音视频第三方库.md","ref":"chinese/native/音视频第三方库.md","articles":[]},{"title":"相关代码","level":"1.17.7","depth":2,"path":"chinese/native/相关代码.md","ref":"chinese/native/相关代码.md","articles":[]}]},"previous":{"title":"kotlin部分","level":"1.15","depth":1,"path":"chinese/kotlin/kotlin部分.md","ref":"chinese/kotlin/kotlin部分.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-search","search-plus","todo","anchor-navigation-ex","copy-code-button","fontsettings","tbfed-pagefooter","local-video","splitter","expandable-chapters","favicon","theme-comscore","local-video"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"( no Copyright，enjoy youself ! )","modify_label":"The file was updated at :","modify_format":"YYYY-MM-DD HH:mm:ss"},"todo":{},"splitter":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"family":"sans","size":2,"theme":"white"},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"favicon":{"shortcut":"assets/images/favicon.ico","bookmark":"assets/images/favicon.ico"},"theme-comscore":{},"local-video":{},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"Aivin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Aivin开发笔记","language":"zh-hans","gitbook":"*","description":"Aivin开发笔记"},"file":{"path":"chinese/flutter/flutter部分.md","mtime":"2022-04-04T02:49:02.758Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2022-04-04T03:47:09.782Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

